3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 03:47:20 +00:00

feat: Add support for excluding files via files-ignore input (#369)

This commit is contained in:
Tonye Jack 2022-02-14 22:33:45 -05:00 committed by GitHub
parent 690deb84ea
commit acb1d7db82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 16 deletions

View file

@ -10,14 +10,6 @@ on:
- main
jobs:
cleanup-runs:
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, 'main')"
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.3.3
env:
GITHUB_TOKEN: ${{ github.token }}
shellcheck:
name: Run shellcheck
runs-on: ubuntu-latest
@ -231,7 +223,8 @@ jobs:
.github/workflows/test.yml
action.yml
**/test.txt
!test/test/test.txt
files_ignore: |
test/test/test.txt
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-specific.outputs) }}'

View file

@ -128,10 +128,13 @@ Support this project with a :star:
| token | `string` | `false` | `${{ github.token }}` | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
| separator | `string` | `true` | `' '` | Output string separator |
| files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) |
| files-separator | string | false | `'\n'` | Separator used to split the<br>files input |
| base\_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
| files_separator | string | false | `'\n'` | Separator used to split the<br>`files` input |
| files\_from\_source\_file | `string` | `false` | | Source file(s) <br> used to populate <br> the `files` input |
| files_ignore | string | false | | Ignore changes to these file(s) |
| files_ignore_separator | string | false | `'\n'` | Separator used to split the <br>`files-ignore` input |
| files_ignore\_from\_source\_file | `string` | `false` | | Source file(s) <br> used to populate <br> the `files_ignore` input |
| sha | `string` | `true` | `${{ github.sha }}` | Specify a different <br> commit SHA <br> used for <br> comparing changes |
| files\_from\_source\_file | `string` | `false` | | Source file <br> used to populate <br> the files input |
| base\_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
| path | `string` | `false` | | Relative path under <br> `GITHUB_WORKSPACE` <br> to the repository |
| since\_last\_remote\_commit | `string` | `false` | `false` | Use the last commit on the remote <br> branch as the `base_sha` <br> (Defaults to the previous commit). <br /> NOTE: This requires <br /> `fetch-depth: 0` <br /> with `actions/checkout@v2` |

View file

@ -12,17 +12,29 @@ inputs:
required: true
default: " "
files_from_source_file:
description: 'Source file to populate the files input'
description: 'Source file(s) to populate the files input'
required: false
default: ""
files:
description: 'Check for changes using only this list of files (Defaults to the entire repo)'
required: false
default: ""
files-separator:
files_separator:
description: 'Separator used to split the files input'
default: "\n"
required: false
files_ignore:
description: 'Ignore changes to this list of files'
required: false
default: ""
files_ignore_separator:
description: 'Separator used to split the files-ignore input'
default: "\n"
required: false
files_ignore_from_source_file:
description: 'Source file(s) to populate the files-ignore input'
required: false
default: ""
sha:
description: 'Specify a current commit SHA used for comparing changes'
required: true
@ -136,8 +148,11 @@ runs:
id: glob
with:
files: ${{ inputs.files }}
files-separator: ${{ inputs.files-separator }}
files-separator: ${{ inputs.files_separator }}
excluded-files: ${{ inputs.files_ignore }}
excluded-files-separator: ${{ inputs.files_ignore_separator }}
files-from-source-file: ${{ inputs.files_from_source_file }}
excluded-files-from-source-file: ${{ inputs.files_ignore_from_source_file}}
working-directory: ${{ inputs.path }}
base-sha: ${{ steps.changed-files-diff-sha.outputs.previous_sha }}
sha: ${{ steps.changed-files-diff-sha.outputs.current_sha }}

View file

@ -1 +1 @@
This is a test file
This is a test file.