diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9037986..be5d762 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,21 +29,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Test files has no changes an no warning with autocrlf - uses: ./ - id: changed_files_not_expected_autocrlf - with: - autocrlf: true - files: | - test/*.txt - test/*.sql - test/**/*.txt - test/**/*.sql - - name: Display changed files - if: steps.changed_files_not_expected_autocrlf.outputs.files_changed == 'true' - run: | - echo "Changed files (Not expected): ${{ steps.changed_files_not_expected_autocrlf.outputs.changed_files }}" - exit 1 - name: Test files has no changes uses: ./ id: changed_files_not_expected @@ -61,10 +46,13 @@ jobs: - name: Make changes run: | printf '%s\n' "323442" "424" >> test/new.txt + printf '%s\n' "323442" "424" >> test/new1.txt + printf '%s\n' "323442" "424" >> test/new2.txt - name: Test test/new.txt file has changes uses: ./ id: changed_files_expected with: + separator: '\n' files: | test/*.txt test/*.sql @@ -103,6 +91,8 @@ jobs: with: files: | !test/new.txt + !test/new1.txt + !test/new2.txt !unstaged.txt - name: Verify Changes to unstaged.txt are ignored if: steps.changed_unstaged_files_not_expected.outputs.files_changed != 'false' @@ -115,6 +105,8 @@ jobs: with: files: | !test/new.txt + !test/new1.txt + !test/new2.txt unstaged.txt - name: Verify Changes to unstaged.txt are ignored if: steps.changed_unstaged2_files_expected.outputs.files_changed != 'true' diff --git a/README.md b/README.md index d4178ea..e371dd3 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,13 @@ Support this project with a :star: * Free software: [MIT license](LICENSE) + +## Known Limitation + +> **Warning**: +> +> * Using characters like `\n`, `%`, `.` and `\r` as separators would be [URL encoded](https://www.w3schools.com/tags/ref_urlencode.asp) + ## Report Bugs Report bugs at https://github.com/tj-actions/verify-changed-files/issues. diff --git a/entrypoint.sh b/entrypoint.sh index 8334954..3d13712 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,6 +4,13 @@ set -e echo "::group::verify-changed-files" +INPUT_SEPARATOR="${INPUT_SEPARATOR//\%/%25}" +INPUT_SEPARATOR="${INPUT_SEPARATOR//\./%2E}" +INPUT_SEPARATOR="${INPUT_SEPARATOR//\\n/%0A}" +INPUT_SEPARATOR="${INPUT_SEPARATOR//\\r/%0D}" + +echo "Separator: $INPUT_SEPARATOR" + if [[ -n "$INPUT_FILES_PATTERN_FILE" ]]; then TRACKED_FILES=$(git diff --diff-filter=ACMUXTRD --name-only | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')