Skip to content

Commit

Permalink
better error reporting from unicode checker
Browse files Browse the repository at this point in the history
  • Loading branch information
maltfield committed Aug 8, 2024
1 parent cd22f67 commit 6fd79a0
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/unicode_warn.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################
# File: .github/workflows/unicode_warn.yml
# Version: 0.4
# Version: 0.5
# Purpose: Detects Unicode in PRs and comments the results of findings in PR
# Authors: Michael Altfield <[email protected]>
# Created: 2021-11-20
Expand Down Expand Up @@ -37,9 +37,21 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
apt-get update
apt-get install -y git bsdmainutils
apt-get install -y git bsdmainutils curl jq
git clone "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
shell: bash

- name: Get link to this run
run: |
# https://stackoverflow.com/a/75734917
workflow_id=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs | jq .jobs[].id )
RUN_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${workflow_id}
echo "RUN_URL=${RUN_URL}" >> $GITHUB_ENV
shell: bash

- name: Check diff for unicode
continue-on-error: true
Expand Down Expand Up @@ -109,14 +121,14 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ env.UNICODE_HUMAN_RESULT }}"
body: "${{ env.UNICODE_HUMAN_RESULT }}\n\n([source](${{ env.RUN_URL }}))"
})
# Exit with or without error
- name: Exit with or without error
run: |
if [[ "${{ env.UNICODE_HUMAN_RESULT }}" | grep -Ei "ERROR|WARNING" ]]; then
if [[ $(echo "${{ env.UNICODE_HUMAN_RESULT }}" | grep -Ei "ERROR|WARNING") ]]; then
exit 1
else
exit 0
Expand Down

0 comments on commit 6fd79a0

Please sign in to comment.