-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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
└── 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.
For example:
snapshots:
frontend-dev:
build_args:
VITE_API_URL: "https://my-api-url"
dockerfile: docker/frontend/Dockerfile
auto: true
affected_paths: ["/common", "/frontend"]
backend-dev:
dockerfile: docker/backend/Dockerfile
auto: true
affected_paths: ["/common", "/backend"]
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
...
- Reactions are currently unavailable