Skip to content

fix(ci): normalise a bot's PR title in the job that judges it - #68

Merged
justinmerrell merged 2 commits into
mainfrom
fix/title-normalisation-race
Aug 25, 2026
Merged

fix(ci): normalise a bot's PR title in the job that judges it#68
justinmerrell merged 2 commits into
mainfrom
fix/title-normalisation-race

Conversation

@justinmerrell

Copy link
Copy Markdown
Contributor

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_TOKEN does not trigger a new workflow run.
GitHub suppresses that to prevent loops. So the separate normaliser corrected
the title and left Conventional PR title sitting on the red it had produced
before the edit — a failing check against a title that is now perfectly
valid, with nothing scheduled to look again.

The fix

Move the step into the Conventional PR title job, ahead of the action, and
delete the separate workflow. There is no second event to depend on.

This works because amannn/action-semantic-pull-request re-reads the title
from the REST API rather than trusting the event payload — deliberately, and
for exactly this reason:

The pull request info on the context isn't up to date. When the user updates
the title and re-runs the workflow, it would be outdated. Therefore fetch the
pull request via the REST API to ensure we use the current title.

Confirmed empirically before writing this: re-running the stale failed run on
#66, with its original payload, passed.

Cost

lint-pr.yml goes from pull-requests: read to write. It runs on
pull_request_target, so what makes that safe is that it has no checkout step
and takes every pull-request value through env: rather than a ${{ }}
expansion inside run:. Both were already true; both are now stated in the
file 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

  • Commits are DCO signed off (git commit -s)
  • Commit messages are Conventional and correctly scoped
  • task ci:lint passes locally
  • No specification prose, schema, or conformance fixture is touched

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>
@justinmerrell
justinmerrell merged commit adc4586 into main Aug 25, 2026
7 checks passed
@justinmerrell
justinmerrell deleted the fix/title-normalisation-race branch August 25, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant