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

Use repository_dispatch event to trigger events for merged PRs #117

Open
llucax opened this issue Oct 15, 2020 · 7 comments
Open

Use repository_dispatch event to trigger events for merged PRs #117

llucax opened this issue Oct 15, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@llucax
Copy link

llucax commented Oct 15, 2020

The limitation of actions not being run for pushes done by this action is a bit annoying, as merge commits are not tested.

GiHub offers a repository_dispatch event that can be used to trigger actions manually using a GitHub API call to generate the event.

I wonder if this mechanism can be integrated into this action, so to make sure other actions are ran for merges, one just need to add one more on: event trigger including repository_dispatch.

@pascalgn
Copy link
Owner

@llucax
Copy link
Author

llucax commented Oct 16, 2020

I'm not sure if we are talking about the same thing. If I understand correctly, that is so the automerge action is run on repository_dispatch, right? What I want is the automerge action to trigger the repository_dispatch event, so I can use it as a trigger for my own actions that I want to be run when a PR is auto-merged.

I'm still a bit new to GitHub actions so I'm not sure if I am making sense, but what I actually want is to workaround this limitation: When a pull request is merged by this action, the merge will not trigger other GitHub workflows. by having some configuration to tell the automerge action to create a repository_dispatch event, with a, (possibly configurable) event_type: "automerged".

Would that be possible?

@pascalgn
Copy link
Owner

The workflow_run event is always triggered by this action (as all other actions). I've updated the README accordingly.

@llucax
Copy link
Author

llucax commented Oct 22, 2020

Hi @pascalgn, I still find it hard to see how I can do what I request here. If in my test/deploy workflow I act upon a workflow_run (completed) for the automerge workflow for example, how do I know if the PR was actually merged or the automerge workflow just ran but all the automerge conditions weren't met? Is there any repository you know that has what I am requesting implemented so I can have a look to a full working example?

Thanks!

@runephilosof-abtion
Copy link

When I use this action to automerge a PR (using squash and merge).
A commit is generated in our target branch, but our CI tests are not being run against that commit.
This in turn results in our deployment not being run, because it wait for a green CI before deploying.

@pascalgn
Copy link
Owner

pascalgn commented Nov 5, 2020

Yes, you need to configure that CI action to be triggered on workflow_run, I suppose. But this has nothing to do with the automerge action per se, so I cannot really help you here.

@llucax
Copy link
Author

llucax commented Nov 5, 2020

Sorry to bother you again, but then I assume that you don't know of any examples to point us to, right?

Again, I know very little about GitHub actions as I only started to use them not too long ago, but from what I understand from the documentation of the repository dispatch event, the action should create the even via an API call (and only when the PR was merged) so other workflows can run on: repository_dispatch.

Using just on: workflow_run, it will be triggered on every automerge run, not only when the PR was merged. I'm not sure if there is any way to check if the result of the automerge workflow was a merge or not, but I think it would make much easier to configure this use case if the automerge action would just create a repository_dispatch event with an event_type like automerge-merged (it could also be a configuration variable for the action).

@pascalgn pascalgn added the enhancement New feature or request label Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants