Repository navigation
CI: skip the master push run for already-tested PR merges - #73
Merged
Merged
Conversation
A merged PR was tested twice: once by its pull_request run and again by the push run on master, 8 jobs each time. A new gate job skips the test matrix on a master push when the pushed commit is a merge whose first parent (master's previous head) is an ancestor of the second parent (the PR head) and the PR head has a successful pull_request run. The merge commit then has exactly the tree that the PR run tested. Direct pushes, squash merges and PRs that were behind master still get the full run. Also cancel a superseded PR run when new commits are pushed (master runs are never cancelled), and skip CI for Markdown-only changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every merged PR is tested twice: once by its
pull_requestrun and again by thepushrun on master. That's 8 jobs (about 15 job-minutes) each time.Changes (
.github/workflows/python-package.yml)gatejob (Ubuntu, about 10 s). It skips the test matrix on a master push when all of these hold:pull_requestrun of this workflow.The merge commit then has exactly the tree the PR run tested. Direct pushes, squash merges and PRs that were behind master still get the full run. GitHub empties a workflow run's
pull_requestslist after merging, which is why the check uses commit ancestry rather than PR metadata.Concurrency: a new push to a PR cancels its run in progress. Master runs are never cancelled (the group key is the commit SHA).
paths-ignore: **.mdon both triggers, so Markdown-only changes don't run CI. There are no required status checks, so a docs-only PR is not left waiting.Verified against past merges
I ran the gate logic locally against the real history:
This PR's own run exercises the
pull_requestpath, where the gate always passes through. If this branch is still up to date with master when merged, the push run on master should show the matrix as skipped.🤖 Generated with Claude Code