Skip to content

Commit

Permalink
fix: wait for mergable state before dry run (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored Aug 2, 2024
1 parent d886ad3 commit ae1bb79
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,21 @@ webhooks.on(
event.payload.repository.owner.login === PERMISSIONS_FILE_ORG
) {
const octokit = await getOctokit(event.payload.repository.owner.login);

let mergeableState = event.payload.pull_request.mergeable_state;
let attempt = 0;
while ((!mergeableState || mergeableState === 'unknown') && attempt < 10) {
await new Promise((r) => setTimeout(r, 5000));
attempt++;

const pr = await octokit.pulls.get({
owner: PERMISSIONS_FILE_REPO,
repo: PERMISSIONS_FILE_REPO,
pull_number: event.payload.pull_request.number,
});
mergeableState = pr.data.mergeable_state;
}

await queueDryRun(
octokit,
event.payload.pull_request.merge_commit_sha,
Expand Down

0 comments on commit ae1bb79

Please sign in to comment.