Repository navigation
ci: build every branch again, still without duplicate runs - #13
Merged
Merged
Conversation
#9 removed the `push: ['**']` wildcard to stop the matrix running twice per commit. That worked, but it also removed CI from branches with no open PR — a trade-off I flagged in that PR without knowing it mattered here. It does. This restores branch builds and keeps the deduplication. The wildcard is back on `push`. The duplication is now prevented at the job instead: when both events fire for a branch in this repository, the `push` run covers it and the `pull_request` run is skipped. if: >- github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository Fork PRs are exempted from the skip. A fork's branch produces no `push` event here, so without that exemption a fork PR would get no CI at all — which would be worse than the doubling this is fixing. Trade-off, taken deliberately and worth stating: a same-repository PR is now tested at its branch head rather than at the merge with `main`. Fork PRs keep the merge-result testing `pull_request` provides. For a repository whose branches are mostly its own maintainer's, branch-head testing is the ordinary arrangement; if `main` moves under a long-lived PR, update the branch to get a true signal. The concurrency group now cancels superseded runs on any ref that is not `main` and not a tag, since feature branches are built through `push` again and repeated pushes should not race each other.
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.
#9 removed the
push: ['**']wildcard to stop the matrix running twice on the same commit. It worked — #8 went from six checks to three — but it also removed CI from branches with no open PR. I flagged that trade-off in #9 without knowing whether it mattered to you. It does. This gets both.How
The wildcard is back on
push. The duplication is now prevented at the job rather than at the trigger:When both events fire for a branch in this repository, the
pushrun covers the commit and thepull_requestrun is skipped.Fork PRs are exempted from the skip. A fork's branch produces no
pushevent here, so without that exemption a fork PR would get no CI at all — worse than the doubling this fixes.main, tagsThe trade-off, stated
A same-repository PR is now tested at its branch head, not at the merge with
main. That is whatpushgives you;pull_requestbuildsrefs/pull/N/mergeinstead.Fork PRs keep merge-result testing. For a repository whose branches are mostly its maintainer's, branch-head testing is the ordinary arrangement — but if
mainmoves under a long-lived PR, update the branch to get a true signal. Worth knowing rather than discovering.If you would rather keep merge-result testing for your own PRs and accept the doubling, say so and I will revert to the original triggers — that is a legitimate choice, and the cost is only CI minutes.
Concurrency
Now cancels superseded runs on any ref that is not
mainand not a tag. Feature branches are built throughpushagain, so repeated pushes should supersede rather than race.mainand tags still record every commit.Testing
Workflow-only. YAML validated locally: the wildcard, the tag trigger, the job
ifand the concurrency expression all parse and resolve as intended.This PR is its own partial test: it is a same-repository PR, so it should report three checks from the
pushevent, with thepull_requestrun skipped. What it cannot test from here is the fork path — that only shows the first time someone opens a PR from a fork.