This guide provides comprehensive instructions for setting up GitHub Actions workflows and repository secrets for Sheikh-CLI.
- Overview
- Repository Secrets Setup
- Workflow Configuration
- Manual Triggers
- Monitoring & Troubleshooting
- Best Practices
Sheikh-CLI uses GitHub Actions for:
- Continuous Integration: Automated testing, linting, and building
- Continuous Deployment: Automated publishing to NPM and GitHub releases
- Dependency Management: Automated dependency updates and security patches
- Quality Assurance: Code quality checks and security audits
Purpose: Authenticate with NPM for package publishing
Setup Steps:
-
Login to NPM:
npm login
-
Create a new token:
npm token create --read-only=false
-
Copy the token (format:
npm_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) -
Add to GitHub:
- Go to Repository → Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
NPM_TOKEN - Value:
npm_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Click "Add secret"
Purpose: GitHub API authentication for releases and PRs
Setup Steps:
- This token is automatically provided by GitHub Actions
- No manual setup required
- Used automatically in workflows via
${{ secrets.GITHUB_TOKEN }}
Purpose: Upload coverage reports to Codecov
Setup Steps:
- Sign up at codecov.io
- Connect your GitHub repository
- Copy the repository token
- Add to GitHub secrets as
CODECOV_TOKEN
Purpose: Send deployment notifications to Slack
Setup Steps:
- Create a Slack app in your workspace
- Enable Incoming Webhooks
- Create a webhook URL
- Add to GitHub secrets as
SLACK_WEBHOOK
Purpose: Send release notifications to Discord
Setup Steps:
- Go to Discord server settings
- Integrations → Webhooks
- Create a new webhook
- Copy the webhook URL
- Add to GitHub secrets as
DISCORD_WEBHOOK
Triggers: Push/PR to main/develop branches
Features:
- Lint and format checking
- Multi-version testing (Node.js 18.x, 20.x)
- Build validation
- Security audit
- Coverage reporting
Jobs:
lint: ESLint and Prettier validationtest: Test suite execution with coveragebuild: Build process validationsecurity: Security vulnerability scanning
Triggers: Git tags, manual dispatch
Features:
- Semantic versioning
- Comprehensive testing
- NPM publishing
- GitHub release creation
- Changelog generation
Jobs:
prepare: Version validation and preparationbuild: Build and package creationpublish-npm: Publish to NPM registrycreate-release: Create GitHub releasenotify: Success notifications
Triggers: Push/PR to main/develop branches
Features:
- Advanced codebase analysis
- Multi-agent testing coordination
- Enhanced security scanning
- Code quality metrics
- Automated deployment
Jobs:
agentic-analysis: Codebase analysisagentic-testing: Multi-agent testingsecurity-audit: Enhanced security auditcode-quality: Code quality analysisbuild: Agentic build processdeploy: Automated deploymentmonitoring: Deployment monitoring
Triggers: Weekly schedule (Mondays 9 AM UTC), manual dispatch
Features:
- Automated dependency checking
- Security patch application
- Automated PR creation
- Update validation
Jobs:
check-updates: Dependency update detectioncreate-update-pr: Automated PR creation
# Create a new tag
git tag v2.0.2
# Push the tag
git push origin v2.0.2
# This automatically triggers the release pipeline- Go to GitHub → Actions → Release Pipeline
- Click "Run workflow"
- Enter version number (e.g.,
2.0.2) - Click "Run workflow"
- Go to GitHub → Actions → Dependency Updates
- Click "Run workflow"
- Workflow will check for updates and create PRs if needed
- Go to GitHub → Actions → Agentic CI/CD
- Click "Run workflow"
- Select environment (staging/production)
- Click "Run workflow"
- Go to Repository → Actions tab
- View all workflow runs
- Check individual job logs
- Monitor success/failure rates
- Build Success Rate: Should be >95%
- Test Coverage: Should be >80%
- Security Issues: Should be 0 high/critical
- Deployment Time: Should be <10 minutes
Error: npm ERR! 403 Forbidden
Solutions:
- Verify
NPM_TOKENsecret is correctly set - Check token permissions (should have publish access)
- Ensure package name matches repository name
- Check if version already exists
Error: Test suite failures
Solutions:
- Check test logs for specific failures
- Verify all dependencies are installed
- Check for environment-specific issues
- Review test configuration
Error: High/critical vulnerabilities found
Solutions:
- Review vulnerability details
- Update affected dependencies
- Check if vulnerabilities are false positives
- Consider security exceptions for known issues
Error: Build process fails
Solutions:
- Check build logs for specific errors
- Verify all dependencies are compatible
- Check for missing environment variables
- Review build configuration
# Add to workflow step
- name: Debug step
run: echo "Debug information"
env:
ACTIONS_STEP_DEBUG: true# Verify secrets are available (without exposing values)
- name: Check secrets
run: |
if [ -n "${{ secrets.NPM_TOKEN }}" ]; then
echo "NPM_TOKEN is set"
else
echo "NPM_TOKEN is not set"
fi- Never commit secrets: Use GitHub secrets for sensitive data
- Limit token permissions: Use minimal required permissions
- Regular rotation: Rotate tokens periodically
- Audit access: Regularly review who has access to secrets
- Use caching: Enable npm cache in workflows
- Parallel jobs: Run independent jobs in parallel
- Optimize dependencies: Only install required dependencies
- Clean up artifacts: Remove unnecessary build artifacts
- Test workflows: Test workflows in development branches
- Rollback plan: Have a plan for failed deployments
- Monitoring: Set up alerts for workflow failures
- Documentation: Keep workflow documentation up to date
- Regular updates: Keep GitHub Actions up to date
- Review logs: Regularly review workflow logs
- Optimize workflows: Continuously improve workflow efficiency
- Backup configuration: Keep workflow configurations in version control
- GitHub Actions Documentation
- NPM Token Management
- Codecov Integration
- Slack Webhooks
- Discord Webhooks
If you encounter issues with GitHub Actions setup:
- Check the logs: Review workflow execution logs
- Verify secrets: Ensure all required secrets are set
- Test locally: Run commands locally to verify they work
- Check permissions: Verify repository and token permissions
- Create an issue: Open a GitHub issue with detailed information
For additional help, refer to: