Action to get paths and files changed in a Pull Request event and use these for GitHub Actions matrix.
NOTE: This repository uses lot of the code from the jitterbit/get-changed-files repository.
- Get list of directories changed in a PR
- Get list of files changed in a PR
Get a list of paths to use in a matrix of jobs (v1)
name: 'PR Detect changes'
on:
pull_request:
types: [synchronize, opened, reopened, labeled]
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.paths_list }}
steps:
- uses: actions/checkout@v3
- name: Annotate PR
id: filter
uses: fabidick22/detect-changes-action@v2
with:
path: "modules/"
build:
needs: changes
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-latest
steps:
- run: echo '${{ matrix.package }}'
parameter | description | required | default |
---|---|---|---|
path | Path | false |
./ |
token | The token to use to access the GitHub API | false |
${{ github.token }} |
parameter | description |
---|---|
paths_list |
List of changed paths, example: ["dist", "dist/data"] |
file_list |
List of changed files, example: ["dist/main.tf", "dist/index.js"] |
paths_str |
List of changed paths separated by , example: "dist,dist/data" |
file_str |
List of changed files separated by , example: "dist/main.tf,dist/index.js" |
This action is a node16
action.