peter-evans / enable-pull-request-automerge

A GitHub action to enable auto-merge on a pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error "Pull request is in clean status"

williamboman opened this issue · comments

Hello! I'm trying to add this to one of my repos and I'm running into this error when trying run the action. The full workflow file can be found here. I couldn't really find anything on the internets, do you perhaps have any ideas what might be going wrong? My best guess is that it's attempting to enable automerge before it's ready (definition of ready being: no checks have been registered with the PR yet)

Hi. @williamboman I am also getting a similar error :(
Error: ["Pull request Pull request is in unstable status"]

Hi @williamboman

I've not seen this error before. Is it happening consistently, or just occasionally?

My best guess is that it's attempting to enable automerge before it's ready

You could try waiting a few seconds in a workflow step to see if that solves it. Perhaps there is a small delay on GitHub's side before the PR is ready, as you suggest.

What do you think about doing this inside this workflow instead? I feel like it'd be neat if one did not have to worry about these race conditions. I've come up with a somewhat naive approach in #344. Wdyt?

So I actually debugged this a bit closer and I don't believe this is happening because of some race condition, there has to be something else going on. I added a retry mechanism that sleeps for 30s before retrying, but it's still consistently failing with the same error, even if the PR checks are all registered and even completed.

I think I know what it might've been. I had not made any checks explicitly required under the repo settings - I had only enabled the checkbox itself. If you don't manually add specific checks that are required I believe GitHub's native automerge feature simply doesn't apply

Screenshot 2022-06-16 at 01 42 51

"

Ah, yes. You must have at least one required check set.

It's mentioned in the "conditions" section here.
https://github.com/peter-evans/enable-pull-request-automerge#conditions

The clean status error makes sense now. The pull request had no pending checks and was already able to be merged. I think this error message is new, because when I was developing the action and testing it I never saw that message. Previously, I think it just failed silently.

Thos are pretty bad error messages from their API if you ask me 🙈, it had me running in circles. Would you be open for parsing these error messages or even wrapping the entire exception with a custom error message, like:

catch (e) {
  core.error("Unable to enable automerge. Make sure you have enabled branch protection with at least one status check marked as required. See https://github.com/peter-evans/enable-pull-request-automerge#conditions for more information.")
  throw e
}

I would be happy to parse and capture the clean status error, because I think we can be fairly confident about what that means and how it occurs. I would prefer to capture and handle that one specifically, rather than output a custom error message for all exceptions.

Cool! I went ahead and implemented it in #345! Not sure if you want logging in the helper module, but that's where I'd put it.

Merged and released. Thanks!

I think we can consider this closed. If other error messages emerge we can handle those separately.

Hi all,

I am facing this issue. Even with all conditions met.
It works when using it in a simple github action but in a composite action it fails with:

Error: Unable to enable automerge. Make sure you have enabled branch protection with at least one status check marked as required. See https://github.com/peter-evans/enable-pull-request-automerge#conditions for more information.
Error: Request failed due to following response errors:
 - ["Pull request Pull request is in clean status"]

Maybe it is also related to the fact that the composite action is located in the same repo, where it should open a PR but still it is kind of confusing.

Do you maybe have a an idea?

Quick update: The Pull request was opened against some branch, which did not have any branch protection. It works now.