Detect named changed-path groups inside a workflow and expose the matched labels as an output.
This is useful when workflow-level paths: filters are too coarse and you want to:
- gate jobs based on named path groups
- build a partial matrix from changed folders
- trigger a full rebuild when shared workflow or script paths change
token: GitHub token used to query changed files. Required.config-path: Path to the YAML config file in the current repository. Optional. Default:.github/changed-paths.yml
changed: JSON array of matching labels
Create a config file such as .github/changed-paths.yml:
rebuild-all:
any:
- .github/workflows/build-docker-images.yml
- utils/docker-images/scripts/**
rundler:
any:
- utils/docker-images/rundler/**
bash:
any:
- utils/docker-images/bash/**Each top-level key is an output label.
Supported match modes:
any: match when any glob matches at least one changed fileall: match when every glob matches at least one changed file
jobs:
changed_paths:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.changed_paths.outputs.changed }}
steps:
- uses: actions/checkout@v4
- id: changed_paths
uses: blockopsnetwork/action-path@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: changed_paths
if: ${{ contains(needs.changed_paths.outputs.changed, 'rundler') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "build rundler"Supported events:
pull_requestpush
For pull_request, the action queries changed files from the PR API.
For push, the action compares before and after SHAs from the event payload.