From 488d1bf39d3e3ab18e8fca5bd35783d61fd817ce Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Fri, 4 Oct 2024 09:10:25 -0400 Subject: [PATCH] Reverse order of approve-enable 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. --- bin/automerge-prs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/automerge-prs b/bin/automerge-prs index ecbeed0..64b6a31 100755 --- a/bin/automerge-prs +++ b/bin/automerge-prs @@ -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