Skip to content

Commit

Permalink
Update url_check.yml
Browse files Browse the repository at this point in the history
feat: Improve workflow for broken URL check

- Redirect Python output to a JSON file to avoid potential issues with large outputs in GITHUB_OUTPUT.
- Adjust output processing in `process_results` step to ensure correct handling of multi-line JSON data.
- Properly handle total issues and generate issue table if broken URLs are found.
- Add detailed logging for better visibility of raw output and issue table.
  • Loading branch information
cordt-sei authored Oct 15, 2024
1 parent 83c7583 commit e57cf17
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/url_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@ jobs:
- name: Run link checker
id: run_checker
run: |
output=$(python scripts/urlcheck.py)
echo 'checker_output<<EOF' >> $GITHUB_OUTPUT
echo "$output" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
python scripts/urlcheck.py > checker_output.json
cat checker_output.json
env:
CHECK_PATH: './pages/'

- name: Process results
id: process_results
run: |
output='${{ steps.run_checker.outputs.checker_output }}'
json_output=$(cat checker_output.json)
echo "Raw output:"
echo "$output"
json_output=$(echo "$output" | grep -Eo '\{.*\}')
echo "$json_output"
total_issues=$(echo "$json_output" | jq -r '.total_issues')
echo "TOTAL_ISSUES=$total_issues" >> $GITHUB_ENV
Expand Down

0 comments on commit e57cf17

Please sign in to comment.