You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address PRs by number instead of head branch name (#45)
A head branch can carry several PRs (one per base), so `gh` calls keyed
by branch name can comment on, label, or retarget the wrong PR — the
same ambiguous-lookup family as the bug fixed in #39. Every `gh` call
that acts on a specific PR now uses the PR number:
- The squash-merge fan-out carries number/branch pairs from `gh pr list`
(numbers for `gh`, branches for `git`).
- The conflict-resolved run gets `PR_NUMBER` from the event payload via
`action.yml`.
This is also an opportunity to drop an API call: the synchronize payload
already carries the PR's base branch, so the resume's manual-retarget
check now reads it from a new `PR_BASE` env var instead of `gh pr view
--json baseRefName`. The resume test's gh mock no longer answers
`baseRefName` queries, so a reintroduced lookup fails loudly.
Stacked on #42 (the changes overlap in `main()`); this PR retargets onto
`main` once #42 lands.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions <github-actions@github.com>
# Recover them from the marker the squash-merge run left in the conflict
222
232
# comment.
223
233
local MARKER
224
-
MARKER=$(read_state_marker "$PR_BRANCH")
234
+
MARKER=$(read_state_marker "$PR_NUMBER")
225
235
if [[ -z"$MARKER" ]];then
226
236
echo"⚠️ No autorestack state marker on $PR_BRANCH; cannot resume safely. Removing the label."
227
-
abandon_resume "$PR_BRANCH""ℹ️ autorestack could not find its state marker on this PR, so it will not update the stack automatically. If this PR still needs its base updated, update its base manually."
237
+
abandon_resume "$PR_NUMBER""ℹ️ autorestack could not find its state marker on this PR, so it will not update the stack automatically. If this PR still needs its base updated, update its base manually."
echo"⚠️ Recorded target branch '$NEW_TARGET' no longer exists; abandoning resume of $PR_BRANCH."
255
-
abandon_resume "$PR_BRANCH""ℹ️ The branch this PR was being retargeted onto (\`$NEW_TARGET\`) no longer exists, so autorestack stepped back. If this PR still needs its base updated, update its base manually."
260
+
abandon_resume "$PR_NUMBER""ℹ️ The branch this PR was being retargeted onto (\`$NEW_TARGET\`) no longer exists, so autorestack stepped back. If this PR still needs its base updated, update its base manually."
0 commit comments