fix(ci): normalise a bot's PR title in the job that judges it - #68
Merged
Conversation
The normaliser added in #65 was a workflow of its own, on the assumption that its retitle would re-run the title check. It does not: a retitle made with GITHUB_TOKEN does not trigger a new workflow run — GitHub suppresses that to prevent loops — so the check sits on the red it produced before the edit, with a title that is now correct. Both recreated Dependabot pull requests showed it. #66 stayed red with a correct title until the run was re-run by hand. #60 went green, but only because Dependabot pushed again a minute later. Folding the step into the `Conventional PR title` job removes the second event from the picture entirely. It works because the action re-reads the title from the REST API rather than the event payload, deliberately and for exactly this reason — re-running the stale failed run on #66, with its original payload, passed. Costs lint-pr.yml `pull-requests: write`. It has no checkout step and takes every pull request value through `env:`, which is what makes that safe on pull_request_target; both are now stated in the file. Signed-off-by: Justin Merrell <merrelljustin@gmail.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.
Follow-up to #65. The normaliser it added was a workflow of its own, on the
assumption that its retitle would re-run the title check. That assumption is
wrong, and the two recreated Dependabot pull requests showed it within minutes.
A retitle made with
GITHUB_TOKENdoes not trigger a new workflow run.GitHub suppresses that to prevent loops. So the separate normaliser corrected
the title and left
Conventional PR titlesitting on the red it had producedbefore the edit — a failing check against a title that is now perfectly
valid, with nothing scheduled to look again.
Luck, not design.
The fix
Move the step into the
Conventional PR titlejob, ahead of the action, anddelete the separate workflow. There is no second event to depend on.
This works because
amannn/action-semantic-pull-requestre-reads the titlefrom the REST API rather than trusting the event payload — deliberately, and
for exactly this reason:
Confirmed empirically before writing this: re-running the stale failed run on
#66, with its original payload, passed.
Cost
lint-pr.ymlgoes frompull-requests: readtowrite. It runs onpull_request_target, so what makes that safe is that it has no checkout stepand takes every pull-request value through
env:rather than a${{ }}expansion inside
run:. Both were already true; both are now stated in thefile so they survive editing.
ADR 0016 §3 is corrected to describe what actually works, and the rejected
separate-workflow design is recorded under Alternatives so it is not tried
again.
Checklist
git commit -s)task ci:lintpasses locally