Skip to content

Commit 9076915

Browse files
authoredJan 20, 2024
feat: add support for matching non ascii characters (#371)
* 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
1 parent b5c4e3e commit 9076915

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed
 

Diff for: ‎.github/workflows/test.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,34 @@ jobs:
5959
printf '%s\n' "323442" "424" >> test/new1.txt
6060
printf '%s\n' "323442" "424" >> test/new2.txt
6161
printf '%s\n' "323442" "424" >> "test/\$(whoami).txt"
62+
printf '%s\n' "323442" "424" >> test/啊啊啊.txt
6263
shell: bash
6364
- name: Test test/new*.txt file has changes
6465
uses: ./
6566
id: changed_files_expected
6667
with:
6768
separator: '\n'
6869
path: test
70+
quotepath: false
6971
files: |
7072
*.{txt,sql}
7173
**/*.{txt,sql}
7274
- name: Display changed files
7375
if: steps.changed_files_expected.outputs.files_changed == 'true'
7476
run: |
7577
echo "Changed files: ${{ steps.changed_files_expected.outputs.changed_files }}"
76-
- name: Verify Changes to test/new.txt
77-
if: steps.changed_files_expected.outputs.files_changed != 'true'
78+
- name: Verify Changes to test/**.txt
79+
if: |
80+
(
81+
steps.changed_files_expected.outputs.files_changed != 'true' ||
82+
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new.txt') ||
83+
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new1.txt') ||
84+
!contains(steps.changed_files_expected.outputs.changed_files, 'test/new2.txt') ||
85+
!contains(steps.changed_files_expected.outputs.changed_files, 'test/$\(whoami\).txt') ||
86+
!contains(steps.changed_files_expected.outputs.changed_files, 'test/啊啊啊.txt')
87+
)
7888
run: |
79-
echo "No Changes found: (Not expected)"
89+
echo "No Changes found or missing changed files: (Not expected)"
8090
exit 1
8191
- name: Test fail if changed
8292
uses: ./

Diff for: ‎action.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ inputs:
3030
required: false
3131
default: "true"
3232
path:
33-
description: "Relative path under GITHUB_WORKSPACE to the repository"
34-
required: false
35-
default: '.'
33+
description: "Relative path under GITHUB_WORKSPACE to the repository"
34+
required: false
35+
default: '.'
36+
quotepath:
37+
description: "Use non-ASCII characters to match files and output the filenames completely verbatim by setting this to `false`"
38+
default: "true"
39+
required: false
3640

3741
outputs:
3842
files_changed:
@@ -72,7 +76,8 @@ runs:
7276
INPUT_FAIL_MSG: ${{ inputs.fail-message }}
7377
INPUT_SAFE_OUTPUT: ${{ inputs.safe_output }}
7478
INPUT_PATH: ${{ inputs.path }}
75-
79+
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
80+
7681
branding:
7782
icon: file-text
7883
color: white

Diff for: ‎entrypoint.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ INPUT_SEPARATOR="${INPUT_SEPARATOR//\\r/%0D}"
1010
echo "::group::verify-changed-files"
1111
echo "::debug::Separator: $INPUT_SEPARATOR"
1212

13+
git config --global core.quotepath "$INPUT_QUOTEPATH"
14+
1315
if [[ -n $INPUT_PATH ]]; then
1416
REPO_DIR="$GITHUB_WORKSPACE/$INPUT_PATH"
1517

0 commit comments

Comments
 (0)
Please sign in to comment.