A workflow in a repository has this trigger:on:
push:
branches: [main]
pull_request:
branches: [main]A developer pushes a commit to a new branch feature/login, opens a pull request from feature/login into main, pushes one more commit to feature/login, and finally merges the pull request. All work happens in the same repository. Which runs of this workflow appear in the Actions tab?
Choose one.
Reading a trigger means combining branch filters for each event with the default activity types of pull_request, and knowing that a merge is a push to the base branch.
The push event is filtered to main, so pushing to feature/login creates nothing. pull_request with branches: [main] filters on the base branch; with no types listed it runs for opened, synchronize and reopened, so opening the pull request and pushing another commit each start a run. Merging creates a commit on main, which is a push to main and starts the third run. A closed activity is not in the default list, so there is no separate run for closing.
- Apply the push branch filter to each push: feature/login fails it, the merge into main passes it.
- Recall the default pull_request activity types: opened, synchronize and reopened.
- Match each action: open is opened, the extra commit is synchronize.
- Count the runs: two pull_request runs plus one push run.
Exam tip: pull_request without types runs on opened, synchronize and reopened; a merge shows up as a push to the base branch.
Troubleshoot GitHub Actions Workflow Runs: Logs, Matrix Re-runs and Artifacts (GH-200) — the lesson that teaches this.