Skip to content

Commit

Permalink
feat: add support for matching non ascii characters (#371)
Browse files Browse the repository at this point in the history
* feat: add support for matching non ascii characters

* feat: add support for matching non ASCII filenames (#372)

* Update entrypoint.sh

* Update test.yml

* Update test.yml

* Update test.yml

* Update test.yml

* Update test.yml
  • Loading branch information
jackton1 committed Jan 20, 2024
1 parent b5c4e3e commit 9076915
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,34 @@ jobs:
printf '%s\n' "323442" "424" >> test/new1.txt
printf '%s\n' "323442" "424" >> test/new2.txt
printf '%s\n' "323442" "424" >> "test/\$(whoami).txt"
printf '%s\n' "323442" "424" >> test/啊啊啊.txt
shell: bash
- name: Test test/new*.txt file has changes
uses: ./
id: changed_files_expected
with:
separator: '\n'
path: test
quotepath: false
files: |
*.{txt,sql}
**/*.{txt,sql}
- name: Display changed files
if: steps.changed_files_expected.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files_expected.outputs.changed_files }}"
- name: Verify Changes to test/new.txt
if: steps.changed_files_expected.outputs.files_changed != 'true'
- name: Verify Changes to test/**.txt
if: |
(
steps.changed_files_expected.outputs.files_changed != 'true' ||
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new.txt') ||
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new1.txt') ||
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new2.txt') ||
!contains(steps.changed_files_expected.outputs.changed_files, 'test/$\(whoami\).txt') ||
!contains(steps.changed_files_expected.outputs.changed_files, 'test/啊啊啊.txt')
)
run: |
echo "No Changes found: (Not expected)"
echo "No Changes found or missing changed files: (Not expected)"
exit 1
- name: Test fail if changed
uses: ./
Expand Down
13 changes: 9 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ inputs:
required: false
default: "true"
path:
description: "Relative path under GITHUB_WORKSPACE to the repository"
required: false
default: '.'
description: "Relative path under GITHUB_WORKSPACE to the repository"
required: false
default: '.'
quotepath:
description: "Use non-ASCII characters to match files and output the filenames completely verbatim by setting this to `false`"
default: "true"
required: false

outputs:
files_changed:
Expand Down Expand Up @@ -72,7 +76,8 @@ runs:
INPUT_FAIL_MSG: ${{ inputs.fail-message }}
INPUT_SAFE_OUTPUT: ${{ inputs.safe_output }}
INPUT_PATH: ${{ inputs.path }}
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
branding:
icon: file-text
color: white
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ INPUT_SEPARATOR="${INPUT_SEPARATOR//\\r/%0D}"
echo "::group::verify-changed-files"
echo "::debug::Separator: $INPUT_SEPARATOR"

git config --global core.quotepath "$INPUT_QUOTEPATH"

if [[ -n $INPUT_PATH ]]; then
REPO_DIR="$GITHUB_WORKSPACE/$INPUT_PATH"

Expand Down

0 comments on commit 9076915

Please sign in to comment.