I’ve started looking into the path-filtering orb. We have a mono repository that also has the documentation build and publish pipeline in it. I tried to build a path filter controlling the docs and source code workflows more granular.
The logic I came up with is having two parameters one as a workflow guard for building the source code and another one for just building the docs. If we have only changes in the docs folder we can run now a very optimized and cheap workflow and as soon we have changes somewhere else we run the more expensive workflow for building and testing the code.
The path filtering configuration looks like this here:
- path-filtering/filter:
base-revision: feature/path-filter
config-path: .circleci/config.yml
mapping: |
^((?!docs/).)*$ trigger-src true
docs.* trigger-docs true
When I run it in my branch given with base-revision
it works as expected. If I change anything outside of the docs folder trigger-src=true
if have changes in the docs folder trigger-docs=true
. The parameter variables are initialized as false
.
My question is now, how can I get this working for any branch someone creates in our repository? As far I’ve understood, I have to specifically use the base-revision
parameter. If it’s not set it defaults to the branch name main
.
The docs for this orb explains base-revision
as:
The revision to compare the current one against for the purpose of determining changed files.
So it seems like as soon someone makes a branch, the person has to update the config.yml and needs to set the base-revision for his branch manually? Ideally, it would be nice if the behavior works in any newly created branch without touching the config.yml file.
Any ideas or hints are welcome and thank you in advance.