Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knu/changed-files
Changed Files for GitHub Actions
https://github.com/knu/changed-files
actions git github github-actions
Last synced: about 1 month ago
JSON representation
Changed Files for GitHub Actions
- Host: GitHub
- URL: https://github.com/knu/changed-files
- Owner: knu
- License: bsd-2-clause
- Created: 2024-03-01T09:59:02.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-19T08:57:15.000Z (8 months ago)
- Last Synced: 2024-05-11T06:40:34.638Z (6 months ago)
- Topics: actions, git, github, github-actions
- Homepage: https://github.com/marketplace/actions/list-changed-files
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Changed Files for GitHub Actions
This GitHub Action returns a list of files changed by a pull request or a push, and a list of files matching a given pattern list.
## Usage
``` yaml
on:
push:pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- id: changed-files
name: Check changed files
uses: knu/changed-files@v1
with:
paths: |
**/*.{json,js,ts,[cm]js}
!**/*.d.ts
- name: Show changed files
run: |
echo "Changed files:"
echo "${{ steps.changed-files.outputs.changed_files }}" | sed 's/^/ /'
echo "Matched files:"
echo "${{ steps.changed-files.outputs.matched_files }}" | sed 's/^/ /'
- name: Run if any file matching paths is changed
if: steps.changed-files.outputs.matched_files != ''
run: |
echo "Do something"
- name: Run if a specific file is changed
if: contains(fromJson(steps.changed-files.outputs.changed_files_json), 'package.json')
run: |
echo "Do something"
```## Inputs
- `paths` (string)
A list of path patterns to match against changed files in the `.gitignore` syntax.
Matching is performed using the [ignore](https://github.com/kaelzhang/node-ignore#readme) library.
- `token` (string)
The GitHub token to use for fetching the list of changed files.
Default: `${{ github.token }}`
## Outputs
- `changed_files`
A multi-line string containing the list of changed files.
- `changed_files_json`
A JSON string containing the list of changed files.
- `matched_files`
A multi-line string containing the list of changed files matching `paths` patterns. Empty (`""`) if `paths` is not given.
- `matched_files_json`
A JSON string containing the list of changed files matching `paths` patterns. Empty (`"[]"`) if `paths` is not given.
## Author
Copyright (c) 2024 Akinori MUSHA.
Licensed under the 2-clause BSD license. See `LICENSE.txt` for details.
Visit the [GitHub Repository](https://github.com/knu/update-tools) for the latest information.