Using path-filtering orb with gitflow or multi-branch setup

Is there a good option for using the path-filtering orb with a gitflow type setup?

For example, if there’s a case where multiple commits are pushed to, e.g., main when a tag is cut, is there a way to handle all these cases:

  • User is PRing from their branch against a branch (compare between current branch and PR base)
  • One or multiple commits pushed to main (in this case via git push when a tag is cut, vs. via a release PR) (compare changes from all pushed commits)
  • We are also using GH merge queues, so there’s those “special” branches containing 1-3 commits as well.
  • PR is merged into default branch (compare against previous commit(s) to default branch.

I see there’s a same-base-run: true parameter to allow looking at the previous commit in the case where the branch is the same, but I’m not sure about a config that will handle all of these different use cases.

I came across this post:

as well as

But would be super helpful if someone has an example of accomplishing something like the above.

Currently, have something like this:

version: 2.1
setup: true

orbs:
  path-filtering: circleci/path-filtering@3.0.0

workflows:
  setup-workflow:
    jobs:
      - path-filtering/filter:
          name: check updated files
          base-revision: <<pipeline.git.branch>>
          config-path: .circleci/workflows/continue_config.yml
          same-base-run: true
          mapping: |
            [...]

I think I could also maybe use Circle’s builtin mustache-like templating to do some very basic fallbacks, if needed.