diff --git a/.github/workflows/unicode_warn.yml b/.github/workflows/unicode_warn.yml index 865fe0a7..bda16277 100644 --- a/.github/workflows/unicode_warn.yml +++ b/.github/workflows/unicode_warn.yml @@ -1,6 +1,6 @@ ################################################################################ # File: .github/workflows/unicode_warn.yml -# Version: 0.3 +# Version: 0.4 # Purpose: Detects Unicode in PRs and comments the results of findings in PR # Authors: Michael Altfield # Created: 2021-11-20 @@ -26,6 +26,11 @@ jobs: pull-requests: write steps: + + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" - name: Prereqs env: @@ -45,11 +50,15 @@ jobs: git config --global --add safe.directory "$(pwd)" git branch -a git log + git checkout ${{ github.event.pull_request.head.ref }} + git branch -a + git log diff=`git diff --unified=0 ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E "^[+]" | grep -Ev '^(--- a/|\+\+\+ b/)'` if [ $? -ne 0 ]; then # there was an error in the diff human_result="WARNING: git diff failed!" + echo "UNICODE_HUMAN_RESULT=${human_result}" >> $GITHUB_ENV echo "${human_result}" exit 1 fi @@ -62,6 +71,7 @@ jobs: if [ $? -ne 0 ]; then # there was an error in the hexdump human_result="WARNING: hexdump failed!" + echo "UNICODE_HUMAN_RESULT=${human_result}" >> $GITHUB_ENV echo "${human_result}" exit 1 fi @@ -106,7 +116,7 @@ jobs: - name: Exit with or without error run: | - if [[ "${{ env.UNICODE_HUMAN_RESULT }}" | grep -i "WARNING" ]]; then + if [[ "${{ env.UNICODE_HUMAN_RESULT }}" | grep -Ei "ERROR|WARNING" ]]; then exit 1 else exit 0