Skip to content

Commit

Permalink
Print failed hyperlinks as errors in actions
Browse files Browse the repository at this point in the history
Remove GH step summary
  • Loading branch information
dormant-user committed May 16, 2024
1 parent 0ad4f85 commit 94bea5b
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ runs:

- name: Download Asset
run: |
response=$(curl -sL "https://api.github.com/repos/thevickypedia/none-shall-pass-rustic/releases/tags/v0.1.7")
response=$(curl -sL "https://api.github.com/repos/thevickypedia/none-shall-pass-rustic/releases/tags/v0.1.8")
release_id=$(echo "$response" | jq -r '.id')
tag_name=$(echo "$response" | jq -r '.tag_name')
published_at=$(echo "$response" | jq -r '.published_at')
Expand Down Expand Up @@ -61,24 +61,19 @@ runs:

- name: Summary
run: |
if [ -f "GH_ACTIONS_SUMMARY" ]; then
echo "::error title=Failed hyperlinks::Following hyperlinks are broken."
while IFS= read -r line || [[ -n "$line" ]]; do
echo "$line" >> $GITHUB_STEP_SUMMARY
done < "GH_ACTIONS_SUMMARY"
else
if [ ! -f "gh_actions_summary.json" ]; then
echo "::notice title=Successful Run::No broken hyperlinks found."
fi
shell: bash

- name: Exit Code
if: inputs.failOnError == 'true'
run: |
if [ -f "GH_ACTIONS_SUMMARY" ]; then
exit 1
else
exit 0
fi
echo "::error title=Failed Hyperlinks::Check the summary for detailed report."
jq -c '.[]' gh_actions_summary.json | while read -r obj; do
filename=$(echo "$obj" | jq -r '.filename')
filepath=$(echo "$obj" | jq -r '.filepath')
text=$(echo "$obj" | jq -r '.text')
url=$(echo "$obj" | jq -r '.url')
echo "::error title=Failed hyperlinks::$text => $url in [$filename](${{ github.server_url }}/${{ github.repository }}/$filepath)"
done
exit 1
shell: bash

branding:
Expand Down

0 comments on commit 94bea5b

Please sign in to comment.