From a0d0d534bb2dd2d0bb1a62bdea1e624de6d79e1f Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:47:19 +0000 Subject: [PATCH] fix(github): Check for a stack before merging the base on conflicts --- .../junior-github/skills/github-code/references/workflow.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/junior-github/skills/github-code/references/workflow.md b/packages/junior-github/skills/github-code/references/workflow.md index c636bb44c9..6aaee086ac 100644 --- a/packages/junior-github/skills/github-code/references/workflow.md +++ b/packages/junior-github/skills/github-code/references/workflow.md @@ -37,8 +37,10 @@ Open this when making repository edits, not for read-only inspection. If the branch has an open PR, check that it can merge. Do this after every push, including fixes for review feedback or failed checks. A conflicted PR gets no new checks. A watched PR gets `pull_request.merge_conflict` only with its next event, so do not wait for it. - Run `gh pr view NUMBER --repo owner/repo --json mergeable,baseRefName`. - `UNKNOWN`: GitHub is still calculating it. Wait about 5 seconds and check again, up to 3 times. If it stays `UNKNOWN`, report that and continue. - - `CONFLICTING`: resolve it now. Do not ask first. GitHub checks mergeability against the PR base (`baseRefName`), which is usually the default branch. Fetch the base and merge `origin/BASE` into the PR branch. Do not rebase. Resolve each conflict so that both the PR change and the base branch change stay intact. Run the checks again, push, and check mergeability again. - - Stacked PR (`gh api 'repos/owner/repo/stacks?pull_request=NUMBER'` returns a stack): a stack merges only with a linear history, so rebase instead of merge. Run `gh stack checkout NUMBER` and `gh stack rebase`, resolve each conflict, run `gh stack rebase --continue`, run the checks, and `gh stack push`. + - `CONFLICTING`: resolve it now. Do not ask first. First check if the PR is in a stack: `gh api 'repos/owner/repo/stacks?pull_request=NUMBER'`. + - In a stack: a stack merges only with a linear history, so do not merge the base. Run `gh stack checkout NUMBER` and `gh stack rebase`, resolve each conflict, run `gh stack rebase --continue`, run the checks, and `gh stack push`. + - Not in a stack: GitHub checks mergeability against the PR base (`baseRefName`), which is usually the default branch. Fetch the base and merge `origin/BASE` into the PR branch. Do not rebase. Resolve each conflict so that both the PR change and the base branch change stay intact. Run the checks again and push. + - Then check mergeability again. 4. Resolve the actual default branch. 5. Update an existing PR for the branch with `github_updatePullRequest`, or create with `github_createPullRequest` (`draft: true` only when work, checks, or decisions remain; otherwise ready for review). 6. PR title matches the current dominant change, same conventional form as commits.