Skip to content

Commit

Permalink
Handle PR automations when quick succession of PR approved and merged (
Browse files Browse the repository at this point in the history
…#4028)

Co-authored-by: sarayourfriend <[email protected]>
  • Loading branch information
dhruvkb and sarayourfriend authored Apr 4, 2024
1 parent 0fe3c1f commit 804f70d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion automations/js/src/project_automation/prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ export const main = async (octokit, core) => {
if (eventName === 'pull_request_review') {
if (pr.isDraft) {
await prBoard.moveCard(prCard.id, prBoard.columns.Draft)
} else {
} else if (!pr.isMerged) {
// Don't touch merged PRs to avoid race condition when a PR is merged
// right after the review and is already in a merged state when
// re-retrieved by the workflow, even though the triggering event was the
// second review.
// In that case we want our handling of merged PRs to take precedence,
// rather than updating the status based on the second review.
await syncReviews(core, pr, prBoard, prCard)
}
} else {
Expand Down

0 comments on commit 804f70d

Please sign in to comment.