CICD-003 · Verify pull requests targeting main
Encyclopedia · Events and triggers · All snippets
Previous · CICD-002 · Next · CICD-004
1. Where it fits
- Placement .github/workflows/ci.yml, at workflow level, or within jobs for a named job mapping.
- Prerequisites workflow on an example repository with main as default.
- Platforms github-actions, gitea-actions.
2. Copy the snippet
yaml
on:
pull_request:
branches: [main]3. How it works
A pull request has a head branch and a target branch. The branches filter under pull_request matches the target, so a PR from feature-x into main can run.
4. Verify the result
The branch filter matches the target branch. Open a PR and check its run.
Watch for. Place event filters at workflow scope and test an event that should run and an event that should be skipped.
Validation syntax-validated (YAML parse). Status definitions.