CI/CD Pipelines: Foundations and Examples/Validate pull requests only

Run CI before code reaches main.

Section: Branching and trigger patterns

Validate pull requests only

yaml
yaml
on:
  pull_request:
    branches: [main]
Explanation

PR validation is the safest default for lint, unit tests, type checks, and build verification.

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
Deploy only from main
Restrict production deployment to your protected main branch.
OpenIn sheetyamlsame section
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.
OpenIn sheetyamlsame section
Minimal GitHub Actions pipeline
Build and test on pushes and pull requests.
Minimal GitLab CI pipeline
Run install, test, and build using stages.
Minimal Jenkins declarative pipeline
Run checkout, install, test, and build in a Jenkinsfile.