Path filtering compared against `master` instead default branch

We are using Actions on our monorepo to run CI workflow on each different paths.

We use filtering such as:


on:
  push:
    paths:
      - api/\*\*

It works fine except that it compares changes against against the master branch and not our project default branch develop (which as changes that might not yet be merged into master). This means some workflow might trigger when there is no change for a given path between the PR target (develop).

Is there something we’re doing wrong or is this an bug?

The trigger doesn’t currently limit itself to any branch. So it will start doing it’s thing on ANY push, regardless of branch. You can make it more specific and have your workflow only target your develop branch (or any other branch you want) to make sure it only runs then:

on:
  push:
    branches:
      - develop
    paths:
      - api/**

The paths check also doesn’t “compare” anything, it reacts to the event, in this case a push event. If your push contains edits to any files in the given paths, it will trigger the workflow. Regardless of what is or is not in master. Any “comparison” is probably done by one of your build steps. Unless I’m misinterpreting your issue.

2 Likes