fix: retry post-creation API calls on 422 eventual consistency errors#4356
Merged
peter-evans merged 1 commit intomainfrom Apr 10, 2026
Merged
fix: retry post-creation API calls on 422 eventual consistency errors#4356peter-evans merged 1 commit intomainfrom
peter-evans merged 1 commit intomainfrom
Conversation
Add retry logic to handle GitHub API eventual consistency errors that can occur after creating a new pull request. Follow-up API calls for milestones, labels, assignees, and reviewers may fail with a 422 "Could not resolve to a node" error before the PR is fully propagated. - Add generic `retryWithBackoff` helper in `src/utils.ts` with exponential backoff (default 2 retries, starting at 1s delay) - Wrap post-creation API calls in `src/github-helper.ts` with `withRetryForNewPr()`, which only retries for newly created PRs - Use `@octokit/request-error` `RequestError` type for precise error matching (status 422 + "Could not resolve to a node" message) - Add unit tests for `retryWithBackoff` covering success, retry, exhaustion, and non-retryable error scenarios - Update `dist/index.js` bundle and `package.json` dependencies
Contributor
|
Full test suite slash command (repository admin only) |
Owner
Author
|
/test repository=peter-evans/create-pull-request ref=422-post-create build=true |
Owner
Author
|
/test repository=peter-evans/create-pull-request ref=422-post-create |
Owner
Author
|
/test repository=peter-evans/create-pull-request ref=422-post-create build=true sign-commits=true |
renovate bot
added a commit
to sdwilsh/ansible-playbooks
that referenced
this pull request
Apr 11, 2026
##### [\`v8.1.1\`](https://github.com/peter-evans/create-pull-request/releases/tag/v8.1.1) #### What's Changed - build(deps-dev): bump the npm group with 2 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4305](peter-evans/create-pull-request#4305) - build(deps): bump minimatch by [@dependabot](https://github.com/dependabot)\[bot] in [#4311](peter-evans/create-pull-request#4311) - build(deps): bump the github-actions group with 2 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4316](peter-evans/create-pull-request#4316) - build(deps): bump [@tootallnate/once](https://github.com/tootallnate/once) and jest-environment-jsdom by [@dependabot](https://github.com/dependabot)\[bot] in [#4323](peter-evans/create-pull-request#4323) - build(deps-dev): bump undici from 6.23.0 to 6.24.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#4328](peter-evans/create-pull-request#4328) - build(deps-dev): bump flatted from 3.3.1 to 3.4.2 by [@dependabot](https://github.com/dependabot)\[bot] in [#4334](peter-evans/create-pull-request#4334) - build(deps): bump picomatch by [@dependabot](https://github.com/dependabot)\[bot] in [#4339](peter-evans/create-pull-request#4339) - build(deps-dev): bump handlebars from 4.7.8 to 4.7.9 by [@dependabot](https://github.com/dependabot)\[bot] in [#4344](peter-evans/create-pull-request#4344) - build(deps-dev): bump the npm group with 3 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4349](peter-evans/create-pull-request#4349) - fix: retry post-creation API calls on 422 eventual consistency errors by [@peter-evans](https://github.com/peter-evans) in [#4356](peter-evans/create-pull-request#4356) **Full Changelog**: <peter-evans/create-pull-request@v8.1.0...v8.1.1>
sdwilsh
pushed a commit
to sdwilsh/ansible-playbooks
that referenced
this pull request
Apr 11, 2026
##### [\`v8.1.1\`](https://github.com/peter-evans/create-pull-request/releases/tag/v8.1.1) #### What's Changed - build(deps-dev): bump the npm group with 2 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4305](peter-evans/create-pull-request#4305) - build(deps): bump minimatch by [@dependabot](https://github.com/dependabot)\[bot] in [#4311](peter-evans/create-pull-request#4311) - build(deps): bump the github-actions group with 2 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4316](peter-evans/create-pull-request#4316) - build(deps): bump [@tootallnate/once](https://github.com/tootallnate/once) and jest-environment-jsdom by [@dependabot](https://github.com/dependabot)\[bot] in [#4323](peter-evans/create-pull-request#4323) - build(deps-dev): bump undici from 6.23.0 to 6.24.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#4328](peter-evans/create-pull-request#4328) - build(deps-dev): bump flatted from 3.3.1 to 3.4.2 by [@dependabot](https://github.com/dependabot)\[bot] in [#4334](peter-evans/create-pull-request#4334) - build(deps): bump picomatch by [@dependabot](https://github.com/dependabot)\[bot] in [#4339](peter-evans/create-pull-request#4339) - build(deps-dev): bump handlebars from 4.7.8 to 4.7.9 by [@dependabot](https://github.com/dependabot)\[bot] in [#4344](peter-evans/create-pull-request#4344) - build(deps-dev): bump the npm group with 3 updates by [@dependabot](https://github.com/dependabot)\[bot] in [#4349](peter-evans/create-pull-request#4349) - fix: retry post-creation API calls on 422 eventual consistency errors by [@peter-evans](https://github.com/peter-evans) in [#4356](peter-evans/create-pull-request#4356) **Full Changelog**: <peter-evans/create-pull-request@v8.1.0...v8.1.1>
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.
Fixes #4321
Add retry logic to handle GitHub API eventual consistency errors that can occur after creating a new pull request. Follow-up API calls for milestones, labels, assignees, and reviewers may fail with a 422 "Could not resolve to a node" error before the PR is fully propagated.
retryWithBackoffhelper insrc/utils.tswith exponential backoff (default 2 retries, starting at 1s delay)src/github-helper.tswithwithRetryForNewPr(), which only retries for newly created PRs@octokit/request-errorRequestErrortype for precise error matching (status 422 + "Could not resolve to a node" message)retryWithBackoffcovering success, retry, exhaustion, and non-retryable error scenariosdist/index.jsbundle andpackage.jsondependencies