ci: skip main CI when the merged tree equals a green pull request head #363
No reviewers
Labels
No labels
dependencies
major
security-pin
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
trails-cool/trails!363
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/skip-identical-main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contains the commits of #360 and #361. Merge those first; this PR then shows one commit.
Change
On a push to main,
scripts/ci-scope.mjsasks the Forgejo API for the pull request that the commit merged. The expensive steps are skipped when all of these are true:CI / * (pull_request)check on that head is green.The pull request run tested the same tree with the same workflow file (a PR run checks out the head commit, not a merge result). A merge that changed the tree, a direct push, an API error or a missing status falls through to the path rule of #361. The jobs still run and report, so the
CI / *contexts on main do not change.Verification
The skip cannot run in this PR. The first merge of an up-to-date PR after this is on main shows it: each job logs
CI scope: … tree identical to the green head of pull request #N.Effect
43 minutes in 30 days (1.7% of all runner time, 16% of CI on main). For a skipped push, CI on main takes about 40 s and not about 6.5 minutes, and the two runner slots are free for the CD jobs of the same push.
🤖 Generated with Claude Code