Summary
Since v1.8.0, when using commitMode: "github-api", existing Version Packages PRs are sometimes not reopened after being closed by a force push.
Root Cause
This is a regression introduced by #258 (draft PR support), which changed the existing PR update logic from REST API to GraphQL.
v1.7.0 (REST API — worked correctly):
await octokit.rest.pulls.update({
pull_number: pullRequest.number,
title: finalPrTitle,
body: prBody,
...github.context.repo,
state: "open",
});
v1.8.0 (GraphQL — race condition):
await octokit.graphql(updatePullRequestMutation, {
pullRequestId: pullRequest.node_id,
title: finalPrTitle,
body: prBody,
// state: OPEN is set inside the mutation
});
With commitMode: "github-api", the action force-pushes the branch before calling the PR update. The force push causes GitHub to close the PR. However, when the GraphQL mutation runs immediately after, the GitHub API may still reflect the PR as "open" (due to propagation delay), making state: OPEN in the mutation a no-op. The PR then remains closed permanently.
Steps to Reproduce
- Use
commitMode: "github-api" with changesets/action@v1 (= v1.8.0)
- Merge a PR to
main → Version Packages PR is created ✅
- Merge another PR to
main → action finds the existing Version Packages PR as open, logs updating found pull request #N, but the PR ends up closed and never reopened ❌
- Manually rerunning the workflow reopens the PR correctly ✅
The failure occurs on the second run (when the PR was already opened once by the action). The first run that creates the PR works fine.
Environment
changesets/action@v1 (v1.8.0)
commitMode: "github-api"
- Using a GitHub App token (instead of default
GITHUB_TOKEN)
- Standard GitHub (not GitHub Enterprise)
Summary
Since v1.8.0, when using
commitMode: "github-api", existing Version Packages PRs are sometimes not reopened after being closed by a force push.Root Cause
This is a regression introduced by #258 (draft PR support), which changed the existing PR update logic from REST API to GraphQL.
v1.7.0 (REST API — worked correctly):
v1.8.0 (GraphQL — race condition):
With
commitMode: "github-api", the action force-pushes the branch before calling the PR update. The force push causes GitHub to close the PR. However, when the GraphQL mutation runs immediately after, the GitHub API may still reflect the PR as "open" (due to propagation delay), makingstate: OPENin the mutation a no-op. The PR then remains closed permanently.Steps to Reproduce
commitMode: "github-api"withchangesets/action@v1(= v1.8.0)main→ Version Packages PR is created ✅main→ action finds the existing Version Packages PR as open, logsupdating found pull request #N, but the PR ends up closed and never reopened ❌The failure occurs on the second run (when the PR was already opened once by the action). The first run that creates the PR works fine.
Environment
changesets/action@v1(v1.8.0)commitMode: "github-api"GITHUB_TOKEN)