automerge-action icon indicating copy to clipboard operation
automerge-action copied to clipboard

Q: how to trigger automerge after the checks finish?

Open PovilasAtPoq opened this issue 2 years ago • 7 comments

I assumed that check_suite type completed would be the check which runs after all checks passes. Howerver, it happened now twice: if PR reviews happens before the build check passes, then it's not being merged.

My config

name: automerge
on:
  pull_request:
    types:
      - labeled
  pull_request_review:
    types:
      - submitted
  check_suite:
    types:
      - completed

Merge not happening after the checks complete image

PovilasAtPoq avatar Aug 20 '21 11:08 PovilasAtPoq

Did you have a look at all the events that triggered automerge-action runs? It might be that the build sends the "status" event and not "check_suite"

pascalgn avatar Sep 03 '21 19:09 pascalgn

Did you have a look at all the events that triggered automerge-action runs? It might be that the build sends the "status" event and not "check_suite"

I did try to look it up, but I couldn't find a reasonable event. I assumed one by default would use such an even so would know how it's called. Hence, posted here.

I will try to add

on:
  status

Seems that status doesn't have any types

PovilasAtPoq avatar Sep 07 '21 17:09 PovilasAtPoq

Yes, it doesn't have any types, see the usage example in the README: https://github.com/pascalgn/automerge-action#usage

pascalgn avatar Sep 07 '21 19:09 pascalgn

Yes, it doesn't have any types, see the usage example in the README: pascalgn/automerge-action#usage

thank you

so i ended up adding

	status: {}

and just tested, and it merged it! :) Thank you for your help and the auto-merger itself!

PovilasAtPoq avatar Sep 08 '21 15:09 PovilasAtPoq

Yes, it doesn't have any types, see the usage example in the README: https://github.com/pascalgn/automerge-action#usage

Hi, I think it could be useful to add a comment like:

status: {} # necessary to trigger the action after the other checks have been completed

in the usage sample. I also had this problem and I could not figure out what I was doing wrong, since github check_suite event is quite misleading.

gturi avatar Sep 11 '21 09:09 gturi

For me, status: {} does not seem to work, so I went with a manual trigger at the end of the job in question:

# CI.yaml
      ...
      # last step of the CI job
      - name: Trigger automerge
        uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.TOKEN }}  # generate a personal access token with `public_repo` scope (write access)
          event-type: checks-complete

and then explicitly add this event as trigger to the automerge workflow:

# automerge.yaml
on:
  # trigger when checks complete (manually triggered as final step of CI workflow)
  repository_dispatch:
    types: [checks-complete]

ddelange avatar Feb 01 '22 14:02 ddelange

Same here. Sometimes it works; other times, it doesn't. Removing and reading the tags triggers the workflow, but the experience is not as smooth as it could be.

marcospassos avatar Feb 10 '22 15:02 marcospassos