fix(ci): unblock the daily drafting pipeline (orphan guard + PR token) - #45
Merged
Conversation
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>
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@/tmp/pr45.md