Skip to content

Commit a8187bf

Browse files
committed
Improve error message when mergability of PR is not known
According to https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request, `mergeable` may be `null` if the background checks to compute mergability are not finished running. Improve the error message for this edge case.
1 parent 7c66472 commit a8187bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ class Actor {
170170

171171
const { octokit, thisRepo, issue, sender } = this;
172172

173+
// Don't try merge if mergability is not yet known
174+
if (prInfo.data.mergeable === null) {
175+
await octokit.issues.createComment({ ...thisRepo, issue_number: issue.number, body: `Sorry @${sender}, this PR is still running background checks to compute mergeability. They'll need to complete before this can be merged.` });
176+
return
177+
}
178+
173179
// Don't try merge unmergable stuff
174180
if (!prInfo.data.mergeable) {
175181
await octokit.issues.createComment({ ...thisRepo, issue_number: issue.number, body: `Sorry @${sender}, this PR has merge conflicts. They'll need to be fixed before this can be merged.` });

0 commit comments

Comments
 (0)