Skip to content

ci: auto-tag released versions when the release PR merges - #13004

Merged
zkochan merged 4 commits into
mainfrom
ci/auto-tag-release-on-merge
Jul 15, 2026
Merged

zkochan merged 4 commits into
mainfrom
ci/auto-tag-release-on-merge

Conversation

@zkochan

@zkochan zkochan commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Auto-tags released versions when a release PR is merged, so a release tag can never drift from the version it's supposed to release.

Today the version tag is pushed by hand after merging the release PR. If the tag name doesn't match the version committed on the merge commit, release.yml's plan job (which reads the committed version, not the tag) publishes the committed version to npm but github-release-rust then drafts a GitHub release for v<committed-version> — a tag that doesn't exist as a git ref — and the create-release call fails with 403 Resource not accessible by integration, even though the job has contents: write. That is exactly what happened on the v12.0.0-alpha.11 release: the tag v12.0.0-alpha.12 was pushed onto the commit that bumped the committed version to 12.0.0-alpha.11.

This PR adds .github/workflows/tag-release.yml, which on a merged release-pr/* PR derives each product's tag from its committed manifest (the same manifests plan reads), skips versions already tagged on the remote, and pushes the new tags. Because the tag is derived from the committed version rather than typed, the off-by-one is impossible; because the tag exists as a real ref before release.yml runs, the draft-release step no longer 403s.

Squash Commit Body

The release tag was pushed by hand after merging a release PR, which let
the tag name drift from the version committed on the merge commit. When
they disagree, release.yml's plan job publishes the committed version but
github-release-rust drafts a GitHub release for `v<committed-version>` — a
tag that doesn't exist as a git ref — and the create-release call returns
403 "Resource not accessible by integration" even with contents: write.

Add tag-release.yml: on a merged `release-pr/*` PR it derives each
product's tag from the committed manifest (the same manifests plan reads),
skips versions already tagged on the remote, and pushes the new tags with
UPDATE_LOCKFILE_TOKEN so the push triggers release.yml (a tag pushed with
the default GITHUB_TOKEN would not). Deriving the tag from the committed
version makes the off-by-one impossible, and the tag exists as a real ref
before release.yml runs, so the draft-release step no longer 403s.

A release PR can bump several products at once, landing several tags and
starting a release run apiece; add a `release` concurrency group so they
serialize and plan's already-published gate makes the later runs no-ops.

Drop the now-obsolete "push the version tag after merging" line from the
release PR body.

Checklist

  • The change is CI-only (release orchestration); it applies equally to the TypeScript CLI, the Rust pnpm/ port, and pnpr — the workflow tags all three from their committed manifests.
  • No changeset: this changes only GitHub Actions workflows, not any published package.
  • Added or updated tests.
  • Updated the documentation if needed (updated the release PR body text; no user-facing docs affected).

Written by an agent (Claude Code, claude-opus-4-8).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Release Improvements
    • Merged release pull requests now automatically create and publish version tags to trigger the release workflow.
    • Release runs are serialized to prevent overlapping publishes and to avoid canceling an in-progress release.
    • Existing version tags are preserved: the process skips tags that already exist to prevent duplicate tagging or republishing.
    • Release tag validation now accepts both v*.*.* and pnpr@*.*.* formats.
  • Documentation
    • Updated release pull request instructions to match the tag-based release behavior.

The release tag was pushed by hand after merging a release PR, which let
the tag name drift from the version committed on the merge commit. When
they disagree, release.yml's plan job publishes the committed version but
github-release-rust drafts a GitHub release for `v<committed-version>` — a
tag that doesn't exist as a git ref — and the create-release call returns
403 "Resource not accessible by integration" even with contents: write.

Add tag-release.yml: on a merged `release-pr/*` PR it derives each
product's tag from the committed manifest (the same manifests plan reads),
skips versions already tagged on the remote, and pushes the new tags with
UPDATE_LOCKFILE_TOKEN so the push triggers release.yml (a tag pushed with
the default GITHUB_TOKEN would not). Deriving the tag from the committed
version makes the off-by-one impossible, and the tag exists as a real ref
before release.yml runs, so the draft-release step no longer 403s.

A release PR can bump several products at once, landing several tags and
starting a release run apiece; add a `release` concurrency group so they
serialize and plan's already-published gate makes the later runs no-ops.

Drop the now-obsolete "push the version tag after merging" line from the
release PR body.
Copilot AI review requested due to automatic review settings July 14, 2026 20:23

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The release pipeline now creates product version tags after merged release PRs, skips existing tags, serializes release workflows, accepts both supported tag formats, and documents the automated tagging behavior.

Changes

Release pipeline

Layer / File(s) Summary
Tag released products
.github/workflows/tag-release.yml
Merged release PRs from release-pr/ branches derive product tags from manifest versions, skip existing remote tags, and push new tags at the merge commit.
Serialize releases and update PR text
.github/workflows/release.yml, .github/workflows/create-release-pr.yml
Release runs share a non-canceling release concurrency group, validation accepts v*.*.* and pnpr@*.*.* tags, and generated PR descriptions document automatic tagging through tag-release.yml.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReleasePR as Release PR
  participant TagRelease as tag-release.yml
  participant Git as Git tags
  participant ReleaseWorkflow as release.yml
  ReleasePR->>TagRelease: merged release PR closure event
  TagRelease->>Git: create and push new product version tags
  Git->>ReleaseWorkflow: trigger workflow for v*.*.* or pnpr@*.*.* tags
  ReleaseWorkflow->>ReleaseWorkflow: serialize runs in release concurrency group
Loading

Possibly related PRs

  • pnpm/pnpm#11652: Both changes modify tag-based release workflow triggering and validation.
  • pnpm/pnpm#12201: Both changes relate to release PR automation and downstream release actions.
  • pnpm/pnpm#12613: Both changes modify tag-reference validation in release.yml.

Suggested reviewers: copilot, dependabot[bot]

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/auto-tag-release-on-merge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

CI: auto-tag committed release versions on merged release PRs

🐞 Bug fix ⚙️ Configuration changes ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Auto-push version tags from merged release-pr/* PRs using committed manifest versions.
• Serialize tag-triggered release runs to avoid concurrent publishes racing the plan gate.
• Update release PR body text to remove the manual “push tag after merge” step.
Diagram

graph TD
  A["create-release-pr.yml"] --> B["Release PR (release-pr/*)"] --> C["Merge commit"] --> D["tag-release.yml"] --> E["Push v<version> tags"] --> F["release.yml (on tag push)"]
  F --> G["Plan + publish + draft release"]
  D -.-> H["UPDATE_LOCKFILE_TOKEN (PAT)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Create tags via GitHub API (create/update ref) instead of `git push`
  • ➕ Avoids needing a full git remote push URL and local tag creation
  • ➕ Can be more explicit about permissions and auditability
  • ➖ Still needs a non-default token to trigger downstream workflows
  • ➖ More bespoke API plumbing/error handling; harder to test locally than git commands
2. Make `release.yml` derive the release version from the tag, not manifests
  • ➕ Eliminates mismatch by making the tag authoritative
  • ➕ No extra workflow needed for tagging
  • ➖ Breaks current design where the plan job is based on committed manifests and can gate multiple products independently
  • ➖ Doesn’t address the ergonomic issue of manual tagging; still relies on humans to create the right tag

Recommendation: The PR’s approach (derive tags from the same committed manifests that release.yml reads, and push them immediately on merge) is the most robust way to prevent tag/version drift without reworking the release pipeline. Using a PAT to push tags is appropriate here because it intentionally bypasses GitHub’s workflow-recursion guard so release.yml can run, and the added release concurrency group addresses the real multi-tag race when a single release PR bumps multiple products.

Files changed (3) +93 / -1

Other (3) +93 / -1
create-release-pr.ymlUpdate release PR body to reflect auto-tagging +1/-1

Update release PR body to reflect auto-tagging

• Replaces the instruction to manually push version tags after merging with a note that tags are auto-created by 'tag-release.yml'. Keeps the release PR guidance aligned with the new automation.

.github/workflows/create-release-pr.yml

release.ymlSerialize release runs with a concurrency group +10/-0

Serialize release runs with a concurrency group

• Adds a 'release' concurrency group with 'cancel-in-progress: false' to prevent multiple tag-triggered runs from racing the plan gate when several tags land together. Ensures later runs observe already-published versions and become no-ops instead of double-publishing attempts.

.github/workflows/release.yml

tag-release.ymlNew workflow: auto-tag merged release PR versions +82/-0

New workflow: auto-tag merged release PR versions

• Introduces a 'pull_request.closed' workflow that runs only for merged 'release-pr/*' PRs in 'pnpm/pnpm'. It checks out the merge commit, reads product versions from committed 'package.json' manifests, skips tags that already exist on the remote, and pushes newly created 'v<version>' tags using 'UPDATE_LOCKFILE_TOKEN' so the push triggers 'release.yml'.

.github/workflows/tag-release.yml

@qodo-code-review

qodo-code-review Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Release PR match too broad ✓ Resolved 🐞 Bug ⛨ Security
Description
.github/workflows/tag-release.yml treats any merged PR whose head ref starts with release-pr/ as
a release PR, so an unrelated merged PR using that prefix can auto-push version tags and trigger
release.yml. This is avoidable because create-release-pr.yml uses an exact head/base
relationship (head: release-pr/<target> and base: <target>), but tag-release.yml does not
enforce it.
Code

.github/workflows/tag-release.yml[R23-28]

+    # Only merged release PRs on the main repository. `create-release-pr.yml`
+    # always opens them from a `release-pr/<target>` head branch.
+    if: >-
+      github.repository == 'pnpm/pnpm' &&
+      github.event.pull_request.merged == true &&
+      startsWith(github.event.pull_request.head.ref, 'release-pr/')
Evidence
The tag workflow currently gates only on a branch-name prefix, while the release PR creator
establishes an exact head/base naming contract that is not enforced here; this makes the privileged
tagging step triggerable by unrelated merged PRs with the same prefix.

.github/workflows/tag-release.yml[23-28]
.github/workflows/create-release-pr.yml[56-58]
.github/workflows/create-release-pr.yml[169-182]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`tag-release.yml` runs on any merged PR whose head branch name starts with `release-pr/`. This is a weak provenance check for a privileged action (pushing tags with a PAT), and can unintentionally tag and trigger releases if another PR happens to use that prefix.

## Issue Context
`create-release-pr.yml` always creates release PRs such that:
- head ref is exactly `release-pr/<target>`
- base ref is `<target>`
So `tag-release.yml` can require that exact relationship, and also ensure the head repo is the same repo (not a fork).

## Fix Focus Areas
- .github/workflows/tag-release.yml[23-28]

## Suggested fix
Update the job `if:` to also require:
- `github.event.pull_request.head.repo.full_name == github.repository`
- `github.event.pull_request.head.ref == format('release-pr/{0}', github.event.pull_request.base.ref)`
Optionally (if stable in this repo), also require the PR author/login to match the automation account used by `UPDATE_LOCKFILE_TOKEN`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Missing NAPI version check 🐞 Bug ☼ Reliability ⭐ New
Description
tag-release.yml derives the shared v<version> tag from pnpm/npm/pnpm/package.json without
verifying the fixed-version pairing with pnpm/npm/napi/package.json; if those versions drift, the
workflow can push a remote v<version> tag that then triggers release.yml and fails its
version-consistency validation. Because the tag already exists remotely, recovering typically
requires manual tag cleanup or another version bump before releases can proceed.
Code

.github/workflows/tag-release.yml[R82-84]

+          add_tag pnpm11/pnpm/package.json 'v'
+          add_tag pnpm/npm/pnpm/package.json 'v'
+          add_tag pnpr/npm/pnpr/package.json 'pnpr@'
Evidence
The tagging workflow currently only tags the Rust/pacquet release from pnpm/npm/pnpm/package.json,
while the release workflow enforces that pnpm/npm/pnpm and pnpm/npm/napi must have identical
versions; pushing the tag without the same check can create a remote tag that deterministically
fails the release workflow’s validation if a drift occurs.

.github/workflows/tag-release.yml[63-85]
.github/workflows/release.yml[96-107]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`tag-release.yml` pushes a `v<version>` tag based only on `pnpm/npm/pnpm/package.json`. In `release.yml`, the release plan aborts if `pnpm/npm/pnpm` and `pnpm/npm/napi` versions differ (they are treated as a fixed-version group).

If a drift slips into a merged release PR, the tag-release workflow will still push the `v<version>` tag, which triggers `release.yml` only to fail fast. Since the remote tag now exists, a subsequent fix (that keeps the same version) cannot be retried without manual tag deletion/movement.

### Issue Context
This is a release-orchestration reliability gap: the tag-push step should enforce the same fixed-version invariant that the release pipeline enforces.

### Fix Focus Areas
- .github/workflows/tag-release.yml[63-85]

### Suggested fix
Before calling `add_tag pnpm/npm/pnpm/package.json 'v'`, read `pnpm/npm/napi/package.json` and compare versions. If they differ, emit a clear `::error::...` and `exit 1` *before creating any local tags*.

Example sketch (bash):
- `RUST_VERSION=$(jq -r .version pnpm/npm/pnpm/package.json)`
- `NAPI_VERSION=$(jq -r .version pnpm/npm/napi/package.json)`
- `if [ "$RUST_VERSION" != "$NAPI_VERSION" ]; then echo "::error::..."; exit 1; fi`
- Then proceed to `add_tag pnpm/npm/pnpm/package.json 'v'`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Unvalidated version yields bad tag 🐞 Bug ☼ Reliability
Description
In tag-release.yml, add_tag() builds the tag name with jq -r .version, which returns the
literal string null when .version is missing/invalid; that would push tags like
vnull/pnpr-vnull and they will not match release.yml’s trigger globs, so no release run
starts. Other non-semver or ref-invalid values will instead make git tag fail and abort the
tagging workflow after merge, requiring manual intervention to restore releases.
Code

.github/workflows/tag-release.yml[R65-66]

+            local manifest="$1" prefix="$2" tag
+            tag="${prefix}v$(jq -r .version "$manifest")"
Evidence
The workflow constructs tags from .version without validation, while the release workflow only
runs on tags that include three dot-separated components; therefore jq -r returning null would
produce a pushed tag that never triggers a release run.

.github/workflows/tag-release.yml[63-76]
.github/workflows/tag-release.yml[78-84]
.github/workflows/release.yml[11-20]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`tag-release.yml` derives tag names using `jq -r .version`, which can emit `null` and other unexpected values. This can create tags that don’t trigger `release.yml` (e.g., `vnull`) or cause the tagging job to fail when git rejects the ref name.

### Issue Context
`release.yml` only triggers on tags matching `v*.*.*` and `pnpr-v*.*.*`, so the tag derivation must guarantee an actual semver-ish value with at least `x.y.z`.

### Fix Focus Areas
- .github/workflows/tag-release.yml[65-66]

### Suggested fix
- Change to `jq -er` so missing `.version` fails fast:
 - `version=$(jq -er '.version' "$manifest")`
- Validate `version` matches your expected semver format (at least `^[0-9]+\.[0-9]+\.[0-9]+`), and abort with a clear `::error::` if not.
- Optionally, add a final guard like `git check-ref-format "refs/tags/${prefix}v${version}"` before creating the tag to ensure the ref name is acceptable to git.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Historical comment in tag-release.yml ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new workflow header comment describes the previous manual process ("This replaces the manual
..."), which is disallowed by the comments policy. Keeping comments focused on current behavior
reduces stale or misleading documentation over time.
Code

.github/workflows/tag-release.yml[R4-5]

+# version tags from the committed manifests and push them. This replaces the
+# manual `git tag && git push` step: deriving each tag from the version already
Evidence
PR Compliance ID 772199 prohibits comments that reference prior behavior (e.g., "used to",
"previously", "old implementation"); the added header comment explicitly references the previous
manual tagging step.

Rule 772199: Comments must describe current behavior, not historical implementations
.github/workflows/tag-release.yml[4-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment uses historical phrasing (e.g., `This replaces the manual ...`), which violates the rule that comments must describe current behavior rather than prior implementations.

## Issue Context
Update the header comment to explain the current workflow contract/intent (derive tags from committed manifests to avoid drift) without referencing what was done previously.

## Fix Focus Areas
- .github/workflows/tag-release.yml[3-8]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
5. Pipeline masks ls-remote failures ✓ Resolved 🐞 Bug ☼ Reliability
Description
The seen=... command substitution uses a multi-command pipeline but the script only enables `set
-eu (no pipefail), so git ls-remote` failures can be masked by downstream filters and the
workflow can proceed with an empty/partial tag set. That can lead to incorrect skip decisions and
confusing push failures instead of a clear early error on remote query failure.
Code

.github/workflows/tag-release.yml[R48-56]

+          set -eu
+          REMOTE="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
+
+          # Tags already on the remote, so a re-run or an unchanged product can
+          # never clobber or repush an existing version tag. `seen` is a
+          # space-padded set for the ` $tag ` membership test; it also collects
+          # the tags staged this run so a shared version can't be pushed twice.
+          seen=" $(git ls-remote --tags "$REMOTE" | awk '{ print $2 }' | sed 's#refs/tags/##' | tr '\n' ' ') "
+
Evidence
The script sets set -eu and then builds seen via a pipeline; without pipefail, earlier command
failures can be ignored by the shell, leaving seen incorrect.

.github/workflows/tag-release.yml[48-56]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The script relies on `git ls-remote --tags ... | awk | sed | tr` to populate `seen`, but without `set -o pipefail` a failure in `git ls-remote` may not fail the step.

## Issue Context
This workflow’s correctness depends on accurate knowledge of which tags already exist remotely.

## Fix Focus Areas
- .github/workflows/tag-release.yml[48-56]

## Suggested fix
- Change to `set -euo pipefail`.
- Optionally split the pipeline to explicitly validate `git ls-remote` succeeded, e.g. capture its output first, check non-empty/exit status, then transform it.
- Emit a clear `::error::` and exit if the remote tag listing fails.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. PAT in git remote URL 🐞 Bug ⛨ Security
Description
tag-release.yml interpolates secrets.UPDATE_LOCKFILE_TOKEN into the git remote URL and passes it
to git ls-remote/git push; if git emits the remote URL in diagnostics, the PAT can be exposed to
logs (masking helps but is not a hard guarantee). The token is also present in the process argv
while commands run, which is an avoidable secret-handling risk for a privileged credential.
Code

.github/workflows/tag-release.yml[R44-55]

+        env:
+          GH_TOKEN: ${{ secrets.UPDATE_LOCKFILE_TOKEN }}
+          SHA: ${{ github.event.pull_request.merge_commit_sha }}
+        run: |
+          set -eu
+          REMOTE="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
+
+          # Tags already on the remote, so a re-run or an unchanged product can
+          # never clobber or repush an existing version tag. `seen` is a
+          # space-padded set for the ` $tag ` membership test; it also collects
+          # the tags staged this run so a shared version can't be pushed twice.
+          seen=" $(git ls-remote --tags "$REMOTE" | awk '{ print $2 }' | sed 's#refs/tags/##' | tr '\n' ' ') "
Evidence
The new workflow explicitly builds a remote URL containing the secret token and uses it for remote
operations, which is the risky pattern under review.

.github/workflows/tag-release.yml[44-55]
.github/workflows/tag-release.yml[81-82]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow constructs `REMOTE="https://x-access-token:${GH_TOKEN}@github.com/..."` and uses it in git commands. This puts the PAT in a URL string that may appear in command errors and is present in argv.

## Issue Context
This job is using a PAT specifically so the tag push triggers `release.yml` (workflow recursion guard blocks `GITHUB_TOKEN`-pushed tags). We should keep that behavior while reducing token exposure.

## Fix Focus Areas
- .github/workflows/tag-release.yml[44-55]
- .github/workflows/tag-release.yml[81-82]

## Suggested fix
Prefer one of these approaches:
1) Use the GitHub API via `gh api` with `GH_TOKEN` to create refs (`POST /repos/{owner}/{repo}/git/refs`) and check existence (`GET /repos/{owner}/{repo}/git/ref/tags/<tag>`), avoiding git remotes entirely.
2) If sticking with git, avoid embedding the token in the URL: use `http.extraheader` (Authorization) for the push/ls-remote invocation, or a temporary credential helper/askpass, and keep the remote URL token-free.
Ensure any failure output cannot include the raw token.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 32fc16c

Results up to commit 70e5d74


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Release PR match too broad ✓ Resolved 🐞 Bug ⛨ Security
Description
.github/workflows/tag-release.yml treats any merged PR whose head ref starts with release-pr/ as
a release PR, so an unrelated merged PR using that prefix can auto-push version tags and trigger
release.yml. This is avoidable because create-release-pr.yml uses an exact head/base
relationship (head: release-pr/<target> and base: <target>), but tag-release.yml does not
enforce it.
Code

.github/workflows/tag-release.yml[R23-28]

+    # Only merged release PRs on the main repository. `create-release-pr.yml`
+    # always opens them from a `release-pr/<target>` head branch.
+    if: >-
+      github.repository == 'pnpm/pnpm' &&
+      github.event.pull_request.merged == true &&
+      startsWith(github.event.pull_request.head.ref, 'release-pr/')
Evidence
The tag workflow currently gates only on a branch-name prefix, while the release PR creator
establishes an exact head/base naming contract that is not enforced here; this makes the privileged
tagging step triggerable by unrelated merged PRs with the same prefix.

.github/workflows/tag-release.yml[23-28]
.github/workflows/create-release-pr.yml[56-58]
.github/workflows/create-release-pr.yml[169-182]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`tag-release.yml` runs on any merged PR whose head branch name starts with `release-pr/`. This is a weak provenance check for a privileged action (pushing tags with a PAT), and can unintentionally tag and trigger releases if another PR happens to use that prefix.

## Issue Context
`create-release-pr.yml` always creates release PRs such that:
- head ref is exactly `release-pr/<target>`
- base ref is `<target>`
So `tag-release.yml` can require that exact relationship, and also ensure the head repo is the same repo (not a fork).

## Fix Focus Areas
- .github/workflows/tag-release.yml[23-28]

## Suggested fix
Update the job `if:` to also require:
- `github.event.pull_request.head.repo.full_name == github.repository`
- `github.event.pull_request.head.ref == format('release-pr/{0}', github.event.pull_request.base.ref)`
Optionally (if stable in this repo), also require the PR author/login to match the automation account used by `UPDATE_LOCKFILE_TOKEN`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. PAT in git remote URL 🐞 Bug ⛨ Security
Description
tag-release.yml interpolates secrets.UPDATE_LOCKFILE_TOKEN into the git remote URL and passes it
to git ls-remote/git push; if git emits the remote URL in diagnostics, the PAT can be exposed to
logs (masking helps but is not a hard guarantee). The token is also present in the process argv
while commands run, which is an avoidable secret-handling risk for a privileged credential.
Code

.github/workflows/tag-release.yml[R44-55]

+        env:
+          GH_TOKEN: ${{ secrets.UPDATE_LOCKFILE_TOKEN }}
+          SHA: ${{ github.event.pull_request.merge_commit_sha }}
+        run: |
+          set -eu
+          REMOTE="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
+
+          # Tags already on the remote, so a re-run or an unchanged product can
+          # never clobber or repush an existing version tag. `seen` is a
+          # space-padded set for the ` $tag ` membership test; it also collects
+          # the tags staged this run so a shared version can't be pushed twice.
+          seen=" $(git ls-remote --tags "$REMOTE" | awk '{ print $2 }' | sed 's#refs/tags/##' | tr '\n' ' ') "
Evidence
The new workflow explicitly builds a remote URL containing the secret token and uses it for remote
operations, which is the risky pattern under review.

.github/workflows/tag-release.yml[44-55]
.github/workflows/tag-release.yml[81-82]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow constructs `REMOTE="https://x-access-token:${GH_TOKEN}@github.com/..."` and uses it in git commands. This puts the PAT in a URL string that may appear in command errors and is present in argv.

## Issue Context
This job is using a PAT specifically so the tag push triggers `release.yml` (workflow recursion guard blocks `GITHUB_TOKEN`-pushed tags). We should keep that behavior while reducing token exposure.

## Fix Focus Areas
- .github/workflows/tag-release.yml[44-55]
- .github/workflows/tag-release.yml[81-82]

## Suggested fix
Prefer one of these approaches:
1) Use the GitHub API via `gh api` with `GH_TOKEN` to create refs (`POST /repos/{owner}/{repo}/git/refs`) and check existence (`GET /repos/{owner}/{repo}/git/ref/tags/<tag>`), avoiding git remotes entirely.
2) If sticking with git, avoid embedding the token in the URL: use `http.extraheader` (Authorization) for the push/ls-remote invocation, or a temporary credential helper/askpass, and keep the remote URL token-free.
Ensure any failure output cannot include the raw token.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Historical comment in tag-release.yml ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new workflow header comment describes the previous manual process ("This replaces the manual
..."), which is disallowed by the comments policy. Keeping comments focused on current behavior
reduces stale or misleading documentation over time.
Code

.github/workflows/tag-release.yml[R4-5]

+# version tags from the committed manifests and push them. This replaces the
+# manual `git tag && git push` step: deriving each tag from the version already
Evidence
PR Compliance ID 772199 prohibits comments that reference prior behavior (e.g., "used to",
"previously", "old implementation"); the added header comment explicitly references the previous
manual tagging step.

Rule 772199: Comments must describe current behavior, not historical implementations
.github/workflows/tag-release.yml[4-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment uses historical phrasing (e.g., `This replaces the manual ...`), which violates the rule that comments must describe current behavior rather than prior implementations.

## Issue Context
Update the header comment to explain the current workflow contract/intent (derive tags from committed manifests to avoid drift) without referencing what was done previously.

## Fix Focus Areas
- .github/workflows/tag-release.yml[3-8]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Pipeline masks ls-remote failures ✓ Resolved 🐞 Bug ☼ Reliability
Description
The seen=... command substitution uses a multi-command pipeline but the script only enables `set
-eu (no pipefail), so git ls-remote` failures can be masked by downstream filters and the
workflow can proceed with an empty/partial tag set. That can lead to incorrect skip decisions and
confusing push failures instead of a clear early error on remote query failure.
Code

.github/workflows/tag-release.yml[R48-56]

+          set -eu
+          REMOTE="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
+
+          # Tags already on the remote, so a re-run or an unchanged product can
+          # never clobber or repush an existing version tag. `seen` is a
+          # space-padded set for the ` $tag ` membership test; it also collects
+          # the tags staged this run so a shared version can't be pushed twice.
+          seen=" $(git ls-remote --tags "$REMOTE" | awk '{ print $2 }' | sed 's#refs/tags/##' | tr '\n' ' ') "
+
Evidence
The script sets set -eu and then builds seen via a pipeline; without pipefail, earlier command
failures can be ignored by the shell, leaving seen incorrect.

.github/workflows/tag-release.yml[48-56]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The script relies on `git ls-remote --tags ... | awk | sed | tr` to populate `seen`, but without `set -o pipefail` a failure in `git ls-remote` may not fail the step.

## Issue Context
This workflow’s correctness depends on accurate knowledge of which tags already exist remotely.

## Fix Focus Areas
- .github/workflows/tag-release.yml[48-56]

## Suggested fix
- Change to `set -euo pipefail`.
- Optionally split the pipeline to explicitly validate `git ls-remote` succeeded, e.g. capture its output first, check non-empty/exit status, then transform it.
- Emit a clear `::error::` and exit if the remote tag listing fails.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit b6d9afb


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Unvalidated version yields bad tag 🐞 Bug ☼ Reliability
Description
In tag-release.yml, add_tag() builds the tag name with jq -r .version, which returns the
literal string null when .version is missing/invalid; that would push tags like
vnull/pnpr-vnull and they will not match release.yml’s trigger globs, so no release run
starts. Other non-semver or ref-invalid values will instead make git tag fail and abort the
tagging workflow after merge, requiring manual intervention to restore releases.
Code

.github/workflows/tag-release.yml[R65-66]

+            local manifest="$1" prefix="$2" tag
+            tag="${prefix}v$(jq -r .version "$manifest")"
Evidence
The workflow constructs tags from .version without validation, while the release workflow only
runs on tags that include three dot-separated components; therefore jq -r returning null would
produce a pushed tag that never triggers a release run.

.github/workflows/tag-release.yml[63-76]
.github/workflows/tag-release.yml[78-84]
.github/workflows/release.yml[11-20]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`tag-release.yml` derives tag names using `jq -r .version`, which can emit `null` and other unexpected values. This can create tags that don’t trigger `release.yml` (e.g., `vnull`) or cause the tagging job to fail when git rejects the ref name.

### Issue Context
`release.yml` only triggers on tags matching `v*.*.*` and `pnpr-v*.*.*`, so the tag derivation must guarantee an actual semver-ish value with at least `x.y.z`.

### Fix Focus Areas
- .github/workflows/tag-release.yml[65-66]

### Suggested fix
- Change to `jq -er` so missing `.version` fails fast:
 - `version=$(jq -er '.version' "$manifest")`
- Validate `version` matches your expected semver format (at least `^[0-9]+\.[0-9]+\.[0-9]+`), and abort with a clear `::error::` if not.
- Optionally, add a final guard like `git check-ref-format "refs/tags/${prefix}v${version}"` before creating the tag to ensure the ref name is acceptable to git.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread .github/workflows/tag-release.yml Resolved
@greptile-apps

greptile-apps Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — this is a pure CI workflow addition with well-scoped guards and no changes to published packages.

The new tag-release.yml workflow correctly restricts itself to merged same-repo release-pr/* PRs, reads versions from the exact manifests that release.yml already trusts, handles idempotency via the seen set pre-populated from the remote, and uses set -euo pipefail to abort on any pipeline failure. The release.yml concurrency group prevents concurrent runs from racing through the plan job's already-published gate. No logic errors, unsafe shell constructs, or missing guards were found.

No files require special attention.

Reviews (4): Last reviewed commit: "ci: adopt the Changesets-style pnpr tag ..." | Re-trigger Greptile

Comment thread .github/workflows/tag-release.yml Resolved

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/tag-release.yml:
- Around line 20-29: Configure queued concurrency for both release workflows:
add a dedicated concurrency group with queue set to max in
.github/workflows/tag-release.yml for the tag-release job, and update the
existing concurrency configuration in .github/workflows/release.yml to use queue
max while retaining cancel-in-progress: false. Apply the changes at both
specified sites so simultaneous and successive release runs are preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3116eeb6-23a0-4c34-906c-de4313f46fcd

📥 Commits

Reviewing files that changed from the base of the PR and between 30a59d0 and 70e5d74.

📒 Files selected for processing (3)
  • .github/workflows/create-release-pr.yml
  • .github/workflows/release.yml
  • .github/workflows/tag-release.yml

Comment thread .github/workflows/tag-release.yml Resolved
@qodo-code-review

qodo-code-review Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to b6d9afb

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent out-of-order version publication

Add a guard to prevent out-of-order publishing of versions due to arbitrary
execution order of queued GitHub Actions.

.github/workflows/release.yml [31-33]

 concurrency:
   group: release
   cancel-in-progress: false
 
+jobs:
+  plan:
+    ...
+    steps:
+      ...
+      - name: Reject stale release candidates
+        run: |
+          # For each candidate selected by the plan, compare its committed
+          # version with the package's current npm dist-tag and fail if
+          # publishing it would move that dist-tag backward.
+          node ./scripts/assert-release-candidates-are-current.mjs
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion identifies a valid, albeit rare, edge case with GitHub Actions concurrency ordering, but the proposed fix is somewhat abstract and might overcomplicate the standard release process.

Low
  • More

Previous suggestions

Suggestions up to commit 70e5d74
CategorySuggestion                                                                                                                                    Impact
High-level
Hallucinated action and broken concurrency

Fixes the AI-hallucinated actions/checkout version to a valid one (e.g., v4),
and warns that the concurrency group will cancel intermediate releases if
multiple tags are pushed at once.

Examples:

.github/workflows/tag-release.yml [31-32]
      - name: Checkout the merge commit
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
.github/workflows/release.yml [26-28]
concurrency:
  group: release
  cancel-in-progress: false

Solution Walkthrough:

Before:

# .github/workflows/release.yml
concurrency:
  group: release
  cancel-in-progress: false

# .github/workflows/tag-release.yml
steps:
  - name: Checkout the merge commit
    uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

After:

# .github/workflows/release.yml
# Remove concurrency group, or rethink the multi-tag orchestration
# to avoid GitHub Actions queue limits.

# .github/workflows/tag-release.yml
steps:
  - name: Checkout the merge commit
    uses: actions/checkout@v4
Suggestion importance[1-10]: 10

__

Why: Identifies a fatal hallucinated action version that breaks the workflow and a critical flaw in the concurrency setup that will silently skip releases.

High
Possible issue
Skip missing manifests

Check for the existence of the manifest file before attempting to parse it with
jq.

.github/workflows/tag-release.yml [58-70]

 add_tag() {
   local manifest="$1" tag
+  if [ ! -f "$manifest" ]; then
+    echo "Manifest $manifest not found; skipping"
+    return
+  fi
   tag="v$(jq -r .version "$manifest")"
   case "$seen" in
     *" $tag "*)
       echo "$tag already exists; skipping"
       return
       ;;
   esac
   git tag "$tag" "$SHA"
   to_push+=("$tag")
   seen="$seen$tag "
 }
Suggestion importance[1-10]: 4

__

Why: Adding a file existence check provides basic error handling, though silently skipping missing hardcoded paths might inadvertently hide valid structural changes that should fail loudly.

Low
Ignore annotated tag refs

Use --refs and sed to filter out annotated tag refs and avoid duplicates in the
remote tags list.

.github/workflows/tag-release.yml [55]

-seen=" $(git ls-remote --tags "$REMOTE" | awk '{ print $2 }' | sed 's#refs/tags/##' | tr '\n' ' ') "
+seen=" $(git ls-remote --tags --refs "$REMOTE" \
+  | awk '{print $2}' \
+  | sed -e 's#refs/tags/##' -e 's#\^\{\}##g' \
+  | tr '\n' ' ') "
Suggestion importance[1-10]: 2

__

Why: Using --refs to filter out dereferenced tags is a minor improvement, but the additional sed removal of ^{} is redundant since --refs already excludes them.

Low

- Gate on create-release-pr.yml's exact contract (same-repo head branch
  named `release-pr/<base>`) instead of a `release-pr/` prefix, so a fork
  PR or an unrelated same-prefixed branch can't reach the PAT tag push.
- `set -euo pipefail` so a failed `git ls-remote` aborts instead of
  yielding an empty tag set that makes every version look new.
- `git ls-remote --refs` to drop annotated tags' peeled `^{}` entries.
- Reword the header comment to state the current contract rather than
  what it replaces.
Copilot AI review requested due to automatic review settings July 15, 2026 07:19

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 15, 2026
@zkochan

zkochan commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Thanks for the reviews. Dispositions for the findings that were summary-only (not on an inline thread):

Applied in 2995888

  • Historical-framing comment (Qodo, rule 772199) — reworded the header comment to describe the current contract instead of "this replaces the manual step". Agreed it conflicted with this repo's comment policy.

Declined, with reasons

  • PAT embedded in the git remote URL (Qodo) — kept as-is to match the established pattern in create-release-pr.yml (git push "https://x-access-token:${GH_TOKEN}@github.com/…"). The token is a registered secret (masked in logs) and the runner is single-tenant/ephemeral, so argv exposure isn't a meaningful additional risk. Switching to gh api ref-creation would diverge from the repo convention for no real security gain.
  • "Hallucinated actions/checkout version → use v4" (Qodo, importance 10) — this is incorrect: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 is the pinned SHA used across this repo's workflows (release.yml, create-release-pr.yml, …). Pinning to a SHA is the intended supply-chain hygiene here; v4 would be a downgrade.
  • Guard for a missing manifest before jq (Qodo, importance 4) — the three manifest paths are fixed and are the same ones release.yml's plan job reads. If one moves, failing loudly (via set -e + jq) is the desired behavior; silently skipping would hide a real structural break.

The queue: max concurrency suggestion is answered on its inline thread (left open for a maintainer call).


Written by an agent (Claude Code, claude-opus-4-8).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2995888

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

pnpr's version starts at 0.x, and pnpm's tag history already holds 166
v0.x tags (v0.1.0, v0.2.0, …) plus the v1.x line. Tagging pnpr as
`v<version>` shares that namespace: once pnpr cuts a stable 0.x that
matches an old pnpm tag, the existence check would treat the ancient
pnpm tag as pnpr's and silently skip it, so pnpr would never get its
trigger tag or release.

Give pnpr its own `pnpr-v<version>` tag (it has no GitHub release and no
external consumer of the tag — it ships via npm and GHCR — so it's free
to move) and trigger/validate release.yml on `pnpr-v*.*.*` alongside
`v*.*.*`. plan reads committed manifests regardless of the triggering
tag, so a pnpr-only release still publishes correctly.
Copilot AI review requested due to automatic review settings July 15, 2026 07:35

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit b6d9afb

Use the widely-recognized `pnpr@<version>` form (the Changesets/Lerna
convention) for pnpr's release tag instead of the ad hoc `pnpr-v<version>`
from the previous commit. release.yml triggers and validates
`pnpr@*.*.*` alongside `v*.*.*`; pnpm (v11.x) and pacquet (v12.x) keep
`v<version>`, which get.pnpm.io's install scripts depend on.
Copilot AI review requested due to automatic review settings July 15, 2026 07:41

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 32fc16c

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

31-33: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Pending runs in GitHub Actions concurrency groups do not form a true queue.

When multiple workflows are triggered simultaneously (e.g., several version tags pushed in quick succession by tag-release.yml), GitHub Actions keeps a maximum of one pending run per concurrency group. Any previously pending run in that group is silently canceled.

If three tags are pushed, Run 1 will start, Run 3 will queue, and Run 2 will be canceled while pending. Run 2 will never execute. If the workflow relies on executing a run for every tag (e.g., to generate a tag-specific GitHub Release), the intermediate tags will be skipped entirely.

This confirms the necessity of the open queue: max suggestion (likely referencing a custom queueing mechanism or third-party action). To prevent skipped releases, consider processing all new tags in a single run or using a dedicated job-queueing action instead of native concurrency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 31 - 33, Replace the native
concurrency-only release scheduling with a mechanism that preserves every
tag-triggered release, such as processing all newly pushed tags in one run or
adopting a dedicated queueing action with sufficient capacity. Update the
release workflow’s concurrency configuration and associated execution flow while
retaining the existing release behavior for each tag.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/release.yml:
- Around line 31-33: Replace the native concurrency-only release scheduling with
a mechanism that preserves every tag-triggered release, such as processing all
newly pushed tags in one run or adopting a dedicated queueing action with
sufficient capacity. Update the release workflow’s concurrency configuration and
associated execution flow while retaining the existing release behavior for each
tag.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b16fc09-4369-4dc1-a78d-23b4e2580f09

📥 Commits

Reviewing files that changed from the base of the PR and between b6d9afb and 32fc16c.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • .github/workflows/tag-release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/tag-release.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants