https://github.com/fabidick22/detect-changes-action
Action to get paths and files changed in a Pull Request event and use these for GitHub Actions matrix
https://github.com/fabidick22/detect-changes-action
actions detect-changes github-actions matrix pull-requests
Last synced: about 2 months ago
JSON representation
Action to get paths and files changed in a Pull Request event and use these for GitHub Actions matrix
- Host: GitHub
- URL: https://github.com/fabidick22/detect-changes-action
- Owner: fabidick22
- Created: 2022-06-13T03:52:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T16:33:17.000Z (almost 3 years ago)
- Last Synced: 2026-02-10T20:08:55.415Z (3 months ago)
- Topics: actions, detect-changes, github-actions, matrix, pull-requests
- Language: JavaScript
- Homepage: https://github.com/marketplace/actions/detect-pr-changes
- Size: 194 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# detect-changes-action
Action to get paths and files changed in a Pull Request event and use these for [GitHub Actions matrix](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs)
## Available Features
- Get list of directories changed in a PR
- Get list of files changed in a PR
## Usage
Get a list of paths to use in a matrix of jobs (v1)
```yaml
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_changed }}
steps:
- uses: actions/checkout@v3
- name: Annotate PR
id: filter
uses: fabidick22/detect-changes-action@v1
with:
path: "modules/"
build:
needs: changes
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-latest
steps:
- run: echo '${{ matrix.package }}'
```
## Inputs
| parameter | description | required | default |
| - | - | - | - |
| path | Path | `false` | ./ |
| token | The token to use to access the GitHub API | `false` | ${{ github.token }} |
## Outputs
| 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"` |
## Runs
This action is a `node16` action.