fix(ci): reconcile stale release-please state before the action
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m8s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s

PR #22 kept autorelease: pending after its head branch was deleted. Gitea rewrites head.ref to refs/pull/22/head, so the action cannot tag it and every later run then aborts with 'There are untagged, merged release PRs outstanding' - no new release PR is ever opened.

Add a reconciliation step that marks a pending PR tagged when its tag already exists, and recreates the tag from the manifest at the merge commit when the branch is gone and the tag is missing.
This commit is contained in:
Noel Sabia committed 2026-10-31 19:42:38 +01:00
1 parent e29927bef7
commit 258b03e458
4 files changed
+246

No files matched your search

+51
View File
@@ -16,6 +16,9 @@ sources:
- id: workflow
resource: .gitea/workflows/release-please.yml
title: release-please workflow
- id: reconcile
resource: scripts/reconcile-release-please.mjs
title: release-please state reconciliation
---
# Decision
@@ -97,6 +100,49 @@ confirmed by comparison, not inference: while `fix/release_please` still
existed, PR #23 reported `head.ref = fix/release_please`; every PR whose
branch was gone reported `refs/pull/<n>/head`.
# A pending label outlives the branch and blocks every later release (2026-10-31)
Flipping `default_delete_branch_after_merge` to `false` only protects
branches deleted *after* the change. PR #22's branch was already gone, so
its `head.ref` stayed `refs/pull/22/head` and its `autorelease: pending`
label stayed attached. Run 143 (task 475, 2026-10-27, the run immediately
after #22 merged) shows the full deadlock:
```
❯ Found pull request #22: 'chore: release main'
✖ Bad branch name: refs/pull/22/head
...
✔ Building candidate release pull request for path: .
❯ Found pull request #22: 'chore: release main'
⚠ There are untagged, merged release PRs outstanding - aborting
::set-output:: prs_created=false
::set-output:: releases_created=false
```
The first block fails the tagging phase. The second finds the same
still-pending PR and aborts the propose phase, so no new release PR is
even opened. Every later run (145, 148, 151, 153, 162, 164, 167) has the
same shape. The hand-created `v1.4.0` tag restores the baseline (`found:
v1.4.0`) but does not clear the label, so it does not break the
deadlock. This is the current reason the pipeline is still healthy-looking
and tagless.
The workflow now reconciles that state before the action runs
(`scripts/reconcile-release-please.mjs`):
* merged + `autorelease: pending` + a tag already at the merge commit ->
replace the label with `autorelease: tagged`;
* merged + `autorelease: pending` + head branch gone + no tag -> create
the tag from the version recorded in the manifest at the merge commit
(the exact tag release-please would have made), then swap the label;
* merged + `autorelease: pending` + head branch still present -> leave
it; release-please tags it in the same run.
The step is idempotent and runs on every push to `main` and every manual
dispatch, so a deleted branch cannot silently poison the release pipeline
again. #20 and #21 are not labelled pending, so they do not block; their
tags remain the one-time manual recovery in the table below.
# Recovering the versions that never got a tag
The label alone cannot recover them — #20, #21 and #22 all lost their head
@@ -123,6 +169,11 @@ whole history.
* That the release phase tags correctly once the head branch survives a
merge. The next release cycle proves it.
* That the reconcile step's tag-creation fallback works with a live
token. Only the tag-already-exists path was exercised, in dry-run,
against the live PR #22. The fallback is written from the same Gitea
API shapes (`POST /tags`, `PUT /issues/{index}/labels`) the rest of the
workflow uses.
* That `RELEASE_PLEASE_TOKEN_CV_SITE_NUXT` carries the `write:issue`
scope the same way `PR_GITEA_TOKEN` needed it; the previous failure
was an immediate API rejection consistent with a scope problem.
+4
View File
@@ -1,5 +1,9 @@
# Update Log
## 2026-10-31 (release-please still never tagged: the stale pending label)
* **Fix**: [release-please.yml](../.gitea/workflows/release-please.yml) now runs [scripts/reconcile-release-please.mjs](../scripts/reconcile-release-please.mjs) before the action. The branch-deletion fix from 2026-10-27 only protects branches deleted after the setting changed; PR #22's branch was already gone, so its `autorelease: pending` label was never cleared. The action therefore finds #22 on every run, logs `Bad branch name: refs/pull/22/head`, creates no tag, and then aborts the propose phase with `There are untagged, merged release PRs outstanding` - `prs_created=false`, `releases_created=false`, exit code 0. Evidence: run 143 (task 475, immediately after #22 merged) and every run through 167 has that exact shape; the hand-created `v1.4.0` tag makes the baseline work (`found: v1.4.0`) but does not clear the label. The reconcile script marks a pending PR tagged when its tag already exists, and recreates the tag from the manifest at the merge commit when the head branch is gone and the tag is missing. A dry run against the live API correctly matches #22 to `v1.4.0` and proposes `autorelease: tagged`. See [Release engineering](decisions/release-engineering.md).
## 2026-10-30 (PR-Agent moved into the Gitea compose stack)
* **Refactor**: the `pr-agent` service now lives in `/home/noel/self-hosted/gitea/docker-compose.yml` with `/home/noel/self-hosted/gitea/pr-agent.env`. The separate `/home/noel/self-hosted/pr-agent` stack and the unused `/opt` operator-access scripts were removed; the service is managed with the Gitea stack.