Restrict production deployment to your protected main branch.
Section: Branching and trigger patterns
Deploy only from main
yaml
yaml
on:
push:
branches: [main]Explanation
Keep deploy workflows tighter than CI workflows. A common split is PR checks for CI and push-to-main for CD.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Branching and trigger patterns
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.
Minimal Jenkins declarative pipeline
Run checkout, install, test, and build in a Jenkinsfile.