Skip to content

fix(release): auth release push with RELEASE_PAT for auto-merge#98

Merged
vreshch merged 1 commit intomasterfrom
ci/release-pat
Apr 15, 2026
Merged

fix(release): auth release push with RELEASE_PAT for auto-merge#98
vreshch merged 1 commit intomasterfrom
ci/release-pat

Conversation

@vreshch
Copy link
Copy Markdown
Contributor

@vreshch vreshch commented Apr 15, 2026

Summary

Every release PR currently needs a manual gh pr merge <N> --squash (confirmed on v0.14.0, 2026-04-09). Root cause: GITHUB_TOKEN-authored pushes are suppressed from triggering downstream workflows (GitHub prevents recursion), so pr-validation.yml never fires on the release branch, and gh pr merge --auto waits forever at mergeStateStatus=CLEAN for a state change.

Fix

Re-auth origin with an org-scoped RELEASE_PAT before the release push + PR create. With a PAT, the push is authored by a real user and downstream workflows fire normally. Auto-merge then completes when validation passes.

Graceful fallback: ${{ secrets.RELEASE_PAT || secrets.GITHUB_TOKEN }}. If the secret is not set, the workflow behaves exactly as before — zero regression risk until the PAT lands.

Required follow-up (org admin, one-time)

  • Create PAT (classic with repo scope, OR fine-grained with contents:write + pull_requests:write)
  • Add as org-level secret RELEASE_PAT for agentage/cli + agentage/agentkit

Validation plan

After the PAT is configured, running gh workflow run release-prepare.yml -f bump_type=patch -f packages=core,platform -f auto_merge=true should:

  1. Open the release PR
  2. Fire pr-validation.yml automatically (currently never fires on release PRs)
  3. Auto-merge when validation passes
  4. Trigger publish.yml on merge

Paired PR in agentage/cli with the same change.

GITHUB_TOKEN-authored pushes don't fire downstream workflows, so
pr-validation.yml never runs on the release PR and `gh pr merge --auto`
stays stuck at mergeStateStatus=CLEAN forever. Re-auth origin with an
org-scoped RELEASE_PAT before push + PR create. Falls back to
GITHUB_TOKEN so existing release runs keep working until the secret
is configured.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

🎉 PR Validation ✅ PASSED

Commit: 9d99a3810ac075bf677a1515aa0eee2249b7242a
Branch: ci/release-pat

Checks:

  • ✅ Release guard (no version/changelog changes)
  • ✅ Dependencies installed
  • ✅ Type check passed
  • ✅ Linting passed
  • ✅ Format check passed
  • ✅ Tests + coverage passed
  • ✅ Build successful

Ready to merge!


🔗 View workflow run
⏰ Generated at: 2026-04-15T19:53:51.998Z

@vreshch vreshch merged commit b71f432 into master Apr 15, 2026
2 checks passed
@vreshch vreshch deleted the ci/release-pat branch April 15, 2026 19:58
vreshch added a commit that referenced this pull request Apr 15, 2026
PR #98 wired RELEASE_PAT as the preferred token, falling back to
GITHUB_TOKEN. Since RELEASE_PAT is not configured in this org yet,
the fallback resolves to GITHUB_TOKEN — same stuck behavior we set
out to fix.

PAT_TOKEN (created 2026-01-25) is already an org secret. Wire it
as the middle-tier fallback so auto-merge works today; RELEASE_PAT
still takes precedence when a dedicated release PAT is added later.
vreshch added a commit that referenced this pull request Apr 15, 2026
## Summary

#98 wired `RELEASE_PAT` as the preferred token with `GITHUB_TOKEN`
fallback. Since `RELEASE_PAT` is not yet configured, the fallback
resolves to `GITHUB_TOKEN` — the same workflow-suppressing behavior we
set out to fix. Auto-merge is still stuck.

Both repos already have an org-level `PAT_TOKEN` secret (created
2026-01-25). Wire it as the middle-tier fallback: `RELEASE_PAT ||
PAT_TOKEN || GITHUB_TOKEN`. Auto-merge starts working today with zero
new secrets, and `RELEASE_PAT` remains the preferred slot for a
release-scoped PAT later.

## Scope follow-up (nice-to-have, not blocking)

`PAT_TOKEN` may be broader than a release flow strictly needs. After
this lands:

- Create a fine-grained PAT scoped to `contents:write` +
`pull_requests:write`
- Add as org secret `RELEASE_PAT`
- Workflow picks it up automatically (first in the fallback chain) — no
further code change

## Validation

Next release after merge: `gh workflow run release-prepare.yml -f
bump_type=patch -f packages=core,platform -f auto_merge=true` should

1. Push the release branch under `PAT_TOKEN` credentials
2. Fire `pr-validation.yml` automatically
3. Auto-merge when validation passes
4. Trigger `publish.yml` on merge

Paired PR in `agentage/cli` with the identical change.
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