Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Pilot Lvl 1
Message 1 of 3

Workflow on merge base branch into PR branch

tl;dr: I want to react on merging base branch into PR branch but it seems like no `on` definition is working.

 

Following situation:

 

I got a workflow reacting on outdated PRs (we need this for Terraform scripts). "outdated" means PRs branch is not in sync with base branch from which it was created. This workflow updates via GitHub API:

 

...
      - uses: actions/github-script@0.2.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            await github.pulls.updateBranch({owner: context.issue.owner, repo: context.issue.repo, pull_number: context.issue.number})
...

 

Works like a charm and creates a commit like following:

 

Image

 

But problem is: I want to react on this new code base with another workflow and that's not working. Although I got a workflow (for testing purposes) with following `on` definition, there is no reaction :/

 

on:
  pull_request:
    types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, locked, unlocked]
  push:
jobs:
...

 

Image

 

Does anyone have an idea how I could react on this merge commit?

 

Thank you very much in advance!

2 Replies
GitHub Partner
Message 2 of 3

Re: Workflow on merge base branch into PR branch

@alexbde , you can try to listen for push in another workflow and check to see if the commit is a merge commit, here's a great example of this.

https://github.com/lekterable/inclusive-organization-action/blob/master/index.js#L22

Pilot Lvl 1
Message 3 of 3

Re: Workflow on merge base branch into PR branch

@BrightRan Thank you for your answer! As you can see in my question above I already tried to listen for `push` (see line 4 in code listing):

 

on:
  pull_request:
    types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, locked, unlocked]
  push:
jobs:
...

 

I used exactly this configuration and no workflow got triggered.