Path filters on branch push events: diff with another branch

We have a series of workflows that run on push events on non-master branches with path filters, eg:

Workflow 1:

on:
  push:
    branches:
      - '*'
      - '!master'
    paths:
      - fileA

Workflow 2:

on:
  push:
    branches:
      - '*'
      - '!master'
    paths:
      - fileB

If we branch off from master and push two separate commits:

  • commit1 - changes to fileA
  • commit2 - changes to fileB

When we push commit1, workflow 1 will correctly run. When we then push commit2, only workflow 2 will run. If we make a PR for this branch, the checks sections only shows workflow 2 - ie only checks that ran for the latest commit. Workflow 1 could have failed and it wouldn’t even show up in the PR (unless you went to the checks tab and manually selected that commit in a dropdown).

Is there a way to configure the diff that the push event uses for path filters to be against another branch rather than the most recent commit on the PR branch? Basically the same diff that pull request events use? Using a pull request event won’t do the job either, as we want the checks to run when any new commits are added to an existing PR.

Hi @axwalker,

Thank you for being here and our sincere apologies for the delayed response. <Editing to say check out Chris’ answer below> :slight_smile:

@axwalker the pull_request event is what you want to do that.  New runs will be triggered whenever the pull_request is synchronized.