Skip to content

feat(update-release-changelog): skip the update when the release tag exists - #351

Merged
cdivitotawela merged 2 commits into
mainfrom
INFRA-3151-skip-changelog-when-tag-exists
Dec 1, 2026
Merged

cdivitotawela merged 2 commits into
mainfrom
INFRA-3151-skip-changelog-when-tag-exists

Conversation

@cdivitotawela

Copy link
Copy Markdown
Contributor

Summary

Fixes INFRA-3151: the update-release-changelog action failed on pushes to a release branch after its tag was created.

The metamask-mobile and metamask-extension workflows run this action on every push to release/*. Once a release is tagged, auto-changelog rejects the update with Current version already has a tag ('vX.Y.Z'), which is unexpected for a release candidate, and the run fails. The pushes that trigger it are housekeeping, not new changes: the merge of the changelog PR itself, or a merge of stable into the branch. Confirmed in real metamask-mobile runs on release/8.20.1-ota, release/8.20.2-ota and release/8.21.1-ota (Nov 2026).

Changes

  • New input skip-if-tag-exists, default 'true'. Set it to 'false' to keep the previous behaviour.
  • New first step tag-check, before the full-history checkout. It derives v<version> from a release/X.Y.Z or release/X.Y.Z-ota branch name (the pattern the updater accepts), then makes one gh api repos/<repo>/git/ref/tags/<tag> call (exact-ref match).
  • If the tag exists, every later step is skipped and the run finishes successfully. A notice and the job summary report how many commits sit on the branch after the tag.
  • It fails open: an unparseable branch name, or any API error other than a 404, logs a warning and runs the update as before.
  • No change is needed in the two caller workflows.

Behaviour change to be aware of

  • The skip is on by default, so it applies to every caller at @v1 once v1 moves. Public code search found only the mobile and extension workflows.
  • It applies whenever the tag exists, including a release that is not the most recent one. auto-changelog only rejected the most recent tag, so pushes to an older tagged release branch are now skipped as well.

Security

  • Inputs go through env: and a strict regex, never ${{ }} in run:. The tag is built only from validated digits.
  • Text echoed into workflow commands has newlines stripped.
  • GH_TOKEN is the token the caller already passes to the action. A GET on a git ref needs contents: read.
  • The step blanks AI_ANALYZER_LITELLM_KEY, like the other steps that do not need it.

Testing

  • Ran the extracted step script against the live GitHub API: existing tags (mobile, mobile -ota, extension), a missing tag, an older tagged release, unparseable names, a newline-injection name, and a bad token (401).
  • yarn lint:misc --check, yarn lint:changelog and git diff --check pass.
  • Not yet run inside GitHub Actions. The expressions and step gating are validated statically only. Before moving v1, point one caller or a scratch workflow at this branch's commit and run three cases: tag exists, tag missing, and skip-if-tag-exists: 'false'.

Critical review

Verdict: OK TO PROCEED (no CRITICAL or HIGH findings). Findings and how they were handled:

Severity Finding Outcome
MEDIUM The skip turns a red run into a silent green one, and "a tagged release is frozen" overstates it. In metamask-mobile the tag can be created before the changelog PR is merged. Fixed in part: the "frozen" wording is removed, and the notice and summary report the commits after the tag. Not a warning, because the routine changelog-PR merge always leaves one commit after the tag and a warning would fire on every normal run. The updater refused these updates before too, so the output is unchanged.
MEDIUM Not exercised in GitHub Actions, and CI does not lint composite actions. Deferred, with the test plan above. The repo lint was run locally. This needs a caller workflow, which cannot be done from this repo.
LOW The skip is broader than the failure it replaces (an older tagged release is now skipped). Accepted, and documented in the changelog.
LOW The legacy Version-vX.Y.Z form in the regex is dead, and the regex is looser than the updater. Fixed: it now matches ^release/X.Y.Z(-ota)?$, as the updater does.
LOW Untrusted text is echoed into workflow commands. Fixed: newlines are stripped.
LOW The changelog entry has no PR link. Fixed in a follow-up commit.

🤖 Generated with Claude Code

cdivitotawela and others added 2 commits December 1, 2026 11:15
…exists

The update-release-changelog action runs on every push to a release
branch. Once the release is tagged it has shipped, and auto-changelog
rejects the update with "Current version already has a tag", so any later
push failed the run. Those pushes are housekeeping, not new changes: the
merge of the changelog PR itself, or a merge of `stable` into the branch.

Add a `skip-if-tag-exists` input, defaulting to `true`. A new first step
derives `v<version>` from a `release/X.Y.Z` or `release/X.Y.Z-ota` branch
name (the pattern the updater itself accepts) and checks for that tag with
one GitHub API call. If the tag exists, the remaining steps are skipped and
the run finishes successfully, with a notice and a job summary that report
how many commits sit on the branch after the tag. Set
`skip-if-tag-exists: 'false'` to keep the previous behaviour.

The skip applies whenever the tag exists, including for a release that is
not the most recent one, which auto-changelog did not reject.

The check runs before the full-history checkout, so a skipped run does not
pay for it. It fails open: a branch name it cannot parse, or any API error
other than a 404, logs a warning and runs the update as before. The branch
name goes through `env:` and a strict regex, never into the shell directly,
text echoed into workflow commands has newlines stripped, and the step
blanks AI_ANALYZER_LITELLM_KEY like the other steps that do not need it.

Refs: INFRA-3151

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Refs: INFRA-3151

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The default-on skip affects every @v1 caller, but tagged, untagged, and explicit opt-out runs still need validation in GitHub Actions before moving v1.

No open issues 🎉

What changed in this PR

Updates update-release-changelog to skip changelog processing when the release tag already exists, avoiding failures on housekeeping pushes to tagged release branches.

Changes:

  • Adds skip-if-tag-exists, enabled by default, with an opt-out for previous behavior.
  • Checks for the tag before checkout, skips subsequent steps when found, and reports commits after the tag.
  • Documents the behavior, including skipping older tagged releases and proceeding when the tag check fails.
File Description
CHANGELOG.md Documents the new input, skip behavior, reporting, and fallback.
.github/​actions/​update-release-changelog/​action.yml Adds the tag check, skip reporting, and conditions on subsequent steps.

Review effort: Balanced

@cdivitotawela
cdivitotawela merged commit cb35ae6 into main Dec 1, 2026
12 checks passed
@cdivitotawela
cdivitotawela deleted the INFRA-3151-skip-changelog-when-tag-exists branch December 1, 2026 03:05
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.

3 participants