Skip to content

Commit

Permalink
Reverse order of approve-enable
Browse files Browse the repository at this point in the history
If our approval made the PR mergeable (aka "clean status"), then
enabling auto-merge fails.

This should actually be the case often, but we usually succeed because
we do the two actions so quickly. Presumably, GitHub's own state has not
updated yet. Sometimes it does, and we see an error about it.

Reversing the order of operations will produce the same outcome, but
should guarantee the PR is not in clean status when we enable auto-merge
(since it is waiting for our own Approve).

Fixes #15.
  • Loading branch information
pbrisbin committed Oct 4, 2024
1 parent 140f77e commit 488d1bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/automerge-prs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ for json in "$tmp"/*.json; do
*)
printf ' \e[1;37m=>\e[0m \e[32mApprove and enable auto-merge\e[0m\n'
if ((!DRY_RUN)); then
gh_pr review --approve "$number"
gh_pr merge --auto "$number" --"$STRATEGY"
gh_pr review --approve "$number"
fi
;;
esac
Expand Down

0 comments on commit 488d1bf

Please sign in to comment.