Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 5

Tirgger on Pull request merge not working

I set the following

```

name: CI

   on: [push, pull_request]

```

 

But it's not triggered on PR merge.

4 Replies
Pilot Lvl 2
Message 2 of 5

Re: Tirgger on Pull request merge not working

That is correct. By default, a workflow only runs when a pull_request's activity type is openedsynchronize, or reopened. If you want to run a workflow when a PR is closed (and merged), you have to specifically set the closed type in the trigger conditions:

 

on:
  pull_request:
    types: [closed]

 

Additionally, to only make a job run when a PR was actually merged and not just closed without being merged, add the an "if" condition to your job(s) that checks if the merged property of the event is true:

 

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged

    steps:
      - name: Do stuff here...

 

Ground Controller Lvl 1
Message 3 of 5

Re: Tirgger on Pull request merge not working

I tried it all and it not running when the PR is opened or closed.

Ground Controller Lvl 1
Message 4 of 5

Re: Tirgger on Pull request merge not working

Can it be that the issue here is that the PR is opened by automaticly and merged by another action?

 

See here: https://github.com/RedisLabs/redis/tree/unstable/.github/workflows

 

You can see that the first sync.yml is doing auto repo sync and the second ci.yml should be triggered on every PUSH/PR

GitHub Staff
Message 5 of 5

Re: Tirgger on Pull request merge not working

Events that are raised by the actions bot will not trigger other actions workflows.  This is to prevent you from getting in to an endless loop of worklfow runs.  We are looking at options to relax this restriction but we don't have any specifics yet.