Repository navigation
Conversation
Skip the `auto-merge` job for draft PRs and re-run on `ready_for_review`, so eligible PRs are approved and merged once marked ready. Re-check the draft state before `gh pr merge --auto`, since the event payload can be stale. `gh pr merge --auto` fails on draft PRs.
Skip the approval when the token's user has already approved the PR's head commit. Approvals on older commits are ignored, so repos that require approval of the most recent push are re-approved. Re-runs (e.g. on `ready_for_review`) would otherwise approve repeatedly.
Avoid splicing the shell variable into the jq program.
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.
Description
Update the
auto-mergeworkflow to skip draft PRs and PRs whose latest commit is already approved.ready_for_reviewso eligible PRs are approved and merged once marked ready.gh pr merge --auto.Motivation
Prevent
gh pr merge --autofrom failing on draft PRs, and avoid approving the same commit repeatedly on re-runs.Additional details
The draft state is re-checked before merging because
github.event.pull_request.draftis a snapshot from when the event fired. A PR converted to draft while the job is running would otherwise still fail.Approvals on older commits are ignored, so repos that require approval of the most recent push still get re-approved.
Caller workflows in other repos need
types: [opened, synchronize, reopened, ready_for_review]onpull_request_targetto benefit from the re-run onready_for_review.Related issues and pull requests
Related to mdn/browser-compat-data#30934 (failing run: https://github.com/mdn/browser-compat-data/actions/runs/39590369100/job/119189517084).