Repository navigation
ci: stop the changelog gate's cancelled duplicate from reading red - #1417
Merged
Merged
Conversation
`gh pr create --label "changelog exempt"` fires `opened` and `labeled`
together. Both runs shared `concurrency: changelog-${{ github.ref }}` with
`cancel-in-progress`, so one was cancelled, and a cancelled run is not
neutral: it stays in the commit's status rollup beside the run that
finished, as a second `fragment staged`, and the rollup reads FAILURE.
The first commits of #1407 and #1408 read FAILURE with every check that
ran passing, and the heads of #1262, #1258, #1251, #1223, #1184, #909 and
#839 carry the same cancelled-plus-success pair.
Removing only `cancel-in-progress` would not close it: a concurrency group
still cancels a pending run when another queues behind it, and `opened`
plus two labels is three runs. The concurrency block goes entirely. The
job is read-only and takes seconds, so overlapping runs cost nothing.
They do have to agree, though, and the label escape read
`github.event.pull_request.labels`, a snapshot of the moment each event
fired. With cancellation gone, an `opened` run whose payload predates the
label could fail for real on an exempt pull request, beside a `labeled`
run that passed. The step now reads the labels from the pulls API when it
runs, so every run sees the same list. The read is a plain assignment, so
a failed call ends the step under the runner's `bash -e` rather than
reading as "no label", and a `grep -q` never sits under `pipefail`.
A textual test pins both halves, in the style of the module's other
workflow checks. It fails against main's workflow.
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.
A pull request opened with
gh pr create --label "changelog exempt"firesopenedandlabeledtogether. Under the changelog workflow'sconcurrencygroup withcancel-in-progress, one of the two runs was cancelled, and the cancelled run stays in the commit's status rollup as a secondfragment staged. The rollup then reads FAILURE although every check that ran passed.Measured with
statusCheckRollupon the commits involved:fragment stagedthe only red;Change
concurrencyblock is gone. Dropping onlycancel-in-progresswould not be enough, because a group still cancels a pending run when another queues behind it (openedplus two labels is three runs). The job is read-only and takes seconds.github.event.pull_request.labels, which is a snapshot of the moment each event fired, so anopenedrun could fail for real on an exempt pull request beside alabeledrun that passed. The step now reads the labels fromrepos/…/pulls/Nwhen it runs.bash -e. It is not read as "no label", and there is nogrep -qunderpipefail.test_changelog_fragments.pygains a textual pin (noconcurrency, no payload label read), in the style of the module's other workflow checks. It fails against main's workflow.Checked
bash -eagainst live pull requests:test_changelog_fragments.py: 51 passed; the new test fails on main's workflow.fragment stagedruns are the race under the new workflow: two runs (opened,labeled), both SUCCESS, none cancelled.python/bngsim/_rounding.py) and staged no fragment, so its gate passes only if a run sees the label. It was closed and its branch deleted afterwards.unlabeledrun failed with "changes the shipped library (python/bngsim/_rounding.py) and stages no changelog entry".labeledrun passed, andgh pr checksshowedfragment stagedas pass.Not changed here: the commit's
statusCheckRollupcounts every check run on a commit, so on #1418 the redunlabeledrun kept the commit's rollup at FAILURE after the label went back on, althoughgh pr checksshowed pass. That is how the label escape has always behaved after a red run, not something this change introduces.