-
Notifications
You must be signed in to change notification settings - Fork 208
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
Merges PRs when mergeable_state = undefined #234
Comments
Hello @Nek-12, so I was having this problem as well, and i managed to get this working based off of #170 graph LR;
A[create pr]-->B[approve pr];
B-->C[merge pr]
So, when doing it this way (something I was unable to solve) I got the same Automerge action was removed from ci.yml and put it its own ---
name: Auto Merge Pull Request With Approved Label
on:
repository_dispatch:
types: [ ready-to-merge ] # This was the main fix
jobs:
auto-merge:
name: Auto Merge The Created Pull Request
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- id: automerge
name: automerge
uses: pascalgn/automerge-action@v0.15.6
env:
GITHUB_TOKEN: ${{ secrets.SECRET_TOKEN }} # PAT
MERGE_LABELS: "automerge,autogenerated"
MERGE_METHOD: "merge" Then, I have a repo-event:
name: Set Repository Event
permissions:
contents: write
runs-on: ubuntu-latest
needs: [trivy-scan, compose-container]
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: ready-to-merge
client-payload: '{"github": ${{ toJson(github) }}}'
if: github.event_name == 'pull_request' So... Repository Dispatch by peter evens, will create an event called on:
repository_dispatch:
types: [ ready-to-merge ] Will force the automerge action to kick off. Because the action does not natively wait for any PR checks to pass, approval, or statuses at this point (since those requirements are already done), it recognizes that and merges. You can use |
Thanks @Bombarding for such a detailed workaround. Yes, a custom trigger action will definitely work. I'll copy your config :) |
This seems like a bug. This automerge action started after a non-required workflow (one of several) has finished execution.
I don't think we should merge prs that have an undefined state because I specified the "clean" state explicitly.
I'm using PAT to run the action with admin rights.
The text was updated successfully, but these errors were encountered: