Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request is in unstable status #355

Closed
izavads opened this issue Jul 20, 2022 · 15 comments · Fixed by #383
Closed

Pull request is in unstable status #355

izavads opened this issue Jul 20, 2022 · 15 comments · Fixed by #383

Comments

@izavads
Copy link

izavads commented Jul 20, 2022

Hi ,
getting the below message when trying to use the action :

Request failed due to following response errors: - ["Pull request Pull request is in unstable status"]

      - uses: peter-evans/enable-pull-request-automerge@v2
        with:
          token: ${{ secrets.MERGE_SECRET }}
          pull-request-number: ${{ github.event.number }}
          merge-method: squash
@novotl
Copy link

novotl commented Jul 20, 2022

👍 We're observing the same issue

@Celebrate-Reinhard
Copy link

Celebrate-Reinhard commented Jul 20, 2022

same error here

some of my config details...

- name: Create Pull Request
  id: stepIdCpr
  uses: peter-evans/create-pull-request@v4
  with:
    branch: acceptance-promotion
    token: ${{ secrets.... }}
- name: Enable Pull Request Automerge
  if: steps.stepIdCpr.outputs.pull-request-operation == 'created'
  uses: peter-evans/enable-pull-request-automerge@v2
  with:
    token: ${{ secrets.... }}
    pull-request-number: ${{ steps.stepIdCpr.outputs.pull-request-number }}
    merge-method: merge

...and debug output that might help investigating the issue:

##[debug]Evaluating condition for step: 'Enable Pull Request Automerge'
##[debug]Evaluating: (success() && (steps.stepIdCpr.outputs.pull-request-operation == 'created'))
...
##[debug]......Evaluating String:
##[debug]......=> 'pull-request-operation'
##[debug]....=> 'created'
...
##[debug]Expanded: (true && ('created' == 'created'))
##[debug]Result: true
##[debug]Starting: Enable Pull Request Automerge
##[debug]Loading inputs
##[debug]Evaluating: secrets....
...
##[debug]Evaluating: steps.stepIdCpr.outputs.pull-request-number
...
##[debug]Result: '42'
##[debug]Evaluating: github.repository
...
##[debug]Loading env
Run peter-evans/enable-pull-request-automerge@v2
...
Fetching pull request ID
##[debug]PullRequestId: 'PR_...
Enabling auto-merge on pull request ID PR_...
Error: Request failed due to following response errors:
 - ["Pull request Pull request is in unstable status"]
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Enable Pull Request Automerge

@peter-evans
Copy link
Owner

Since you all seemed to experience this at the same time, it's likely that it's an issue on GitHub's side. The action itself has not changed in any way.

@Celebrate-Reinhard
Copy link

@peter-evans Thanks for the quick answer!
In my case: I try to use your (great) action for just some days now. So I cannot ensure that it worked before.

@novotl @izavads Did it work for you before?

@izavads
Copy link
Author

izavads commented Jul 21, 2022

@Celebrate-Reinhard I am a new user as well.

@peter-evans
Copy link
Owner

Ah, my misunderstanding. In that case, please check that you are fulfilling the conditions described here:
https://github.com/peter-evans/enable-pull-request-automerge#conditions

@izavads
Copy link
Author

izavads commented Jul 21, 2022

@peter-evans , yeah I've created a PAT and using it as a secret , auto merge is also enabled under the pull request setting. still getting the same message.

@izavads
Copy link
Author

izavads commented Jul 21, 2022

@peter-evans @novotl @Celebrate-Reinhard
Thanks Peter , I was missing 1 condition (3) : 'The pull request must be in a state where requirements have not yet been satisfied.'

My issue was that the automerge job was set to wait for the job that makes the state to be satisfied , which breaks the condition mentioned above ....
Once moved the automerge job to be the first job without any dependency it works as expected .

@Celebrate-Reinhard
Copy link

@izavads

Once moved the automerge job to be the first job without any dependency it works as expected .

Can you give more details how exactly you did it?

I tried the same and split them up into two different workflows. -> Same error:

While some checks are still running (and therefor the auto-merge requirements are not satisfied), the auto merge is already failing 🤔

grafik

In the screenshot the button already says "Merge pull request". I have the feeling that that is already wrong. Shouldn't that be anything like "prepare for automerge"?

@izavads
Copy link
Author

izavads commented Jul 21, 2022

@Celebrate-Reinhard
i did not split the automerge part to be in a seperated yml workflow
the checks and the automerge is in the same yml in my case
try to check it at the same way , also verify that atleast one check that you are running is required ( you can set it to be required in the protected branch rule ) .

i also made sure that the automerge job runs first

`
jobs:

AutoMerge_PRClose:
runs-on: preProdCi

timeout-minutes: 30
steps:
  - uses: actions-ecosystem/action-add-labels@v1
    with:
      labels: automerge
  - uses: peter-evans/enable-pull-request-automerge@v2
    with:
      token: ${{ secrets.MERGE_SECRET }}
      pull-request-number: ${{github.event.pull_request.number}}
      merge-method: squash

create_virtual_environment:
runs-on: preProdCi
needs: [ AutoMerge_PRClose ]
`

@Celebrate-Reinhard
Copy link

Thank you, @izavads!

also verify that atleast one check that you are running is required ( you can set it to be required in the protected branch rule ) .

This is exactly what I missed!

i did not split the automerge part to be in a seperated yml workflow

I also reverted my split and it's now again like desribed yesterday.

Details for everyone with the same issue like me.

This is how it should look like:
grafik

I just had to define the CI jobs as "required before merging"
grafik

Before, the CI jobs ran and they even could fail, but they were not required. So the PR was always in a merge ready state from the very beginning. And being in that state the auto-merge flag cannot be set; not by UI and not by @peter-evans 's action.

@Celebrate-Reinhard
Copy link

@peter-evans suggestion for making your docu even clearer:

The pull request base must have a branch protection rule with at least one requirement enabled.
In most cases a good candidate for this is a CI job with integration tests that runs for every PR anyway. Add that one in Settings > Branches > Branch protection rule > Require status checks to pass before merging

Thank you for your help and the great action you created!

@novotl
Copy link

novotl commented Jul 22, 2022

In our case another repo admin removed the branch protection rule, so there was no required condition to wait for and it could be merged immediately. After adding back the required check all works fine 👍 .

@williamboman
Copy link
Contributor

I think this error should be caught and display a more helpful error message, basically extending the error message matching that was done in #345, I'll open a PR

@peter-evans
Copy link
Owner

Thanks @williamboman

Released as v2.2.0 / v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants