This guide will help you set up GitHub integration with automated CI/CD pipeline for the Research Assistant project.
- Go to https://github.com/new
- Repository name:
research-assistant(or your preferred name) - Set as Public or Private (your preference)
- Don't initialize with README (we already have one)
- Click "Create repository"
cd /home/ramdov/projects/research-assistant
git remote add github https://github.com/nellaivijay/research-assistant.gitYou need to add your Hugging Face token as a GitHub secret for automated deployment:
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
HF_TOKEN - Value: Your Hugging Face access token
- Click Add secret
To get your Hugging Face token:
- Go to https://huggingface.co/settings/tokens
- Create a new token with "Write" permissions
- Copy the token (starts with
hf_)
# Push current code to GitHub
git push github main- Go to your GitHub repository
- Click on Actions tab
- You should see the CI/CD pipeline running
- The workflow will:
- Run syntax checks
- Install dependencies
- Run basic tests
- Deploy to Hugging Face (if on main branch)
The CI/CD pipeline (.github/workflows/ci-cd.yml) includes:
- Syntax Check: Validates Python syntax
- Dependency Installation: Installs all requirements
- Basic Tests: Tests imports and model configuration
- Security Check: Scans for hardcoded credentials
- Automated Deployment: Pushes to Hugging Face Spaces
- Triggered: Only after successful tests
- Condition: Only on push to main branch
The GitHub Actions workflow runs on:
- Push to main: Full CI/CD + deployment
- Push to develop: CI/CD only (no deployment)
- Pull requests to main: CI/CD only (no deployment)
- Automated Testing: Catches errors before deployment
- Continuous Integration: Tests every change
- Automated Deployment: No manual deployment needed
- Code Quality: Ensures code standards
- Security: Scans for credentials
- Backup: GitHub serves as code backup
- Make changes locally
- Test locally with
python -m py_compile app.py - Commit changes:
git commit -am "Your message" - Push to GitHub:
git push github main - GitHub Actions automatically:
- Runs tests
- Deploys to Hugging Face if tests pass
- Monitor in GitHub Actions tab
If tests fail:
- Check the Actions tab for error details
- Fix the issue locally
- Push the fix
- Actions will automatically retry
If deployment fails:
- Verify
HF_TOKENsecret is set correctly - Check token has "Write" permissions
- Verify Hugging Face Space URL in workflow file
If GitHub Actions fail, you can always deploy manually:
git push origin mainThis pushes directly to Hugging Face (current setup).
- Branch Protection: Enable branch protection on main
- Pull Requests: Use PRs for code review
- Test Locally: Always test before pushing
- Monitor Actions: Check Actions tab regularly
- Secret Security: Never commit secrets or tokens
- HF_TOKEN: Stored as GitHub secret (never in code)
- API Keys: Use environment variables, never hardcode
- Data Files:
.gitignoreprevents committing data - Logs:
.gitignoreprevents committing log files
After setup:
- ✅ Push code to GitHub
- ✅ Verify GitHub Actions run successfully
- ✅ Check deployment to Hugging Face
- ✅ Test the live application
- ✅ Set up branch protection (optional)
Your Research Assistant is now set up with professional-grade CI/CD pipeline! 🎉