From acb1d7db82ebc79fc27c923164f4715c034c0e06 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 14 Feb 2022 22:33:45 -0500 Subject: [PATCH] feat: Add support for excluding files via files-ignore input (#369) --- .github/workflows/test.yml | 11 ++--------- README.md | 9 ++++++--- action.yml | 21 ++++++++++++++++++--- test/test/test.txt | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3153f373..f8333b99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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) }}' diff --git a/README.md b/README.md index 55c98e61..e9f99bca 100644 --- a/README.md +++ b/README.md @@ -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)
or a repo scoped
[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
using only these
list of file(s)
(Defaults to the
entire repo) | -| files-separator | string | false | `'\n'` | Separator used to split the
files input | -| base\_sha | `string` | `false` | | Specify a different
base commit SHA
used for
comparing changes | +| files_separator | string | false | `'\n'` | Separator used to split the
`files` input | +| files\_from\_source\_file | `string` | `false` | | Source file(s)
used to populate
the `files` input | +| files_ignore | string | false | | Ignore changes to these file(s) | +| files_ignore_separator | string | false | `'\n'` | Separator used to split the
`files-ignore` input | +| files_ignore\_from\_source\_file | `string` | `false` | | Source file(s)
used to populate
the `files_ignore` input | | sha | `string` | `true` | `${{ github.sha }}` | Specify a different
commit SHA
used for
comparing changes | -| files\_from\_source\_file | `string` | `false` | | Source file
used to populate
the files input | +| base\_sha | `string` | `false` | | Specify a different
base commit SHA
used for
comparing changes | | path | `string` | `false` | | Relative path under
`GITHUB_WORKSPACE`
to the repository | | since\_last\_remote\_commit | `string` | `false` | `false` | Use the last commit on the remote
branch as the `base_sha`
(Defaults to the previous commit).
NOTE: This requires
`fetch-depth: 0`
with `actions/checkout@v2` | diff --git a/action.yml b/action.yml index a2d176d7..5ada6f96 100644 --- a/action.yml +++ b/action.yml @@ -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 }} diff --git a/test/test/test.txt b/test/test/test.txt index 9f4b6d8b..6de7b8c6 100644 --- a/test/test/test.txt +++ b/test/test/test.txt @@ -1 +1 @@ -This is a test file +This is a test file.