Skip to content

fix(ci): unblock the daily drafting pipeline (orphan guard + PR token) - #45

Merged
abrichr merged 3 commits into
mainfrom
fix/draft-guard-merged-branches
Aug 27, 2026
Merged

fix(ci): unblock the daily drafting pipeline (orphan guard + PR token)#45
abrichr merged 3 commits into
mainfrom
fix/draft-guard-merged-branches

Conversation

@abrichr

@abrichr abrichr commented Aug 26, 2026

Copy link
Copy Markdown
Member

@/tmp/pr45.md

abrichr and others added 3 commits August 26, 2026 18:39
The guard in draft-post.yml means to catch the case where a run authored a
post but could not open the PR, leaving the branch stranded. It tested for
branch existence instead, which is a different thing: a merged PR whose head
branch was never deleted leaves that branch on origin permanently.

auto-draft/2026-07-19-the-bug-that-made-every-openadapt-desktop-install-crash-on-l
merged as #19 on 2026-07-19 and was never deleted, so it had been tripping the
guard on every daily scan since.

Query each branch for a PR in any state and only count it as an orphan when
there is none. Delete the branch when its PR is merged, so these stop
accumulating. A branch whose PR is open or closed-unmerged is left alone,
since its commits are not on main and deleting it would lose the draft.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comments and docs describe what the code does, not what an earlier version
did. The incident that motivated the fix (the merged 2026-07-19 branch, PR
#19, blocking every scan for five weeks) belongs in the commit history and
the PR body, both of which already carry it.
The org setting "Allow GitHub Actions to create and approve pull requests" is
now enabled, so the workflow's own token can open the pull request. Drop the
`GH_TOKEN: ${{ secrets.ADMIN_TOKEN }}` override.

ADMIN_TOKEN is a fine-grained PAT without `pull_requests: write` on this
repository, so it fails with "Resource not accessible by personal access
token". The built-in token is the option that works today and it removes the
dependency on a PAT permission that has been outstanding since 2026-07-28.

This is not free. A PR opened by github-actions[bot] has its checks queued as
`action_required`, so a human presses "Approve and run" before CI reports; a
PAT-opened PR does not. AUTOMATION.md records that cost and how to switch back
if it becomes a nuisance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrichr abrichr changed the title fix: only treat an auto-draft branch as an orphan if it has no PR fix(ci): unblock the daily drafting pipeline (orphan guard + PR token) Aug 27, 2026
@abrichr
abrichr merged commit 341d2ce into main Aug 27, 2026
4 checks passed
@abrichr
abrichr deleted the fix/draft-guard-merged-branches branch August 27, 2026 03:46
abrichr added a commit that referenced this pull request Aug 27, 2026
Auto-drafted 2026-07-28, stranded until the guard fix in #45. Passes lint_post_substance.py --strict; #46 and #47 do not and are declined. Lands as draft: true, so nothing publishes. Advances the scan watermark to 2026-07-28T02:24:34Z.
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