We want to automatically select the images to build, according to the changed paths in a monorepo.
For example, a monorepo with the following structure
└── packages
├── frontend
├── backend
└── common
If we have 2 flavors defined: backend and frontend, and we want to build them automatically (auto: true flag set), but we want to skip the build of the backend module when changes only comes from in the frontend or common path.
To specify this configuration, we could define the flavors to build, with the auto flag set and and advanced filter based on the paths changed by the event that produced the build, before invoking the build_images action.
In the calling workflow that triggers this action, we need to determine which paths are affected, for example
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: |
changed:
- '**'
- uses: actions/github-script@v7
script: |
for change in ${{ filter.outputs.changes }}:
## calculate all the paths affected, from the root of the repo
...
-
Motivation
We want to automatically select the images to build, according to the changed paths in a monorepo.
For example, a monorepo with the following structure
If we have 2 flavors defined:
backend
andfrontend
, and we want to build them automatically (auto: true
flag set), but we want to skip the build of thebackend
module when changes only comes from in thefrontend
orcommon
path.To specify this configuration, we could define the flavors to build, with the auto flag set and and advanced filter based on the paths changed by the event that produced the build, before invoking the build_images action.
For example:
In the calling workflow that triggers this action, we need to determine which paths are affected, for example