Skip to content

Commit 655546a

Browse files
authored
Update url-checker.yml
1 parent 6ba23a2 commit 655546a

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

.github/workflows/url-checker.yml

+26-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
branches:
88
- canary
99
- main
10-
# Enable manual triggering from GitHub Actions tab
1110
workflow_dispatch:
1211
inputs:
1312
fail-on-broken-links:
@@ -42,12 +41,16 @@ jobs:
4241

4342
- name: Check for broken links
4443
id: check_links
45-
continue-on-error: true
4644
run: |
47-
python scripts/python/url-checker/url-checker.py
48-
EXIT_CODE=$?
49-
echo "link_check_exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
50-
45+
# Run the script and capture summary
46+
python scripts/python/url-checker/url-checker.py | tee output.txt
47+
EXIT_CODE=${PIPESTATUS[0]}
48+
echo "link_check_exit_code=${EXIT_CODE}" >> $GITHUB_OUTPUT
49+
50+
# Extract and display the summary specifically
51+
echo "==== URL Checker Summary ===="
52+
grep -A 6 "Summary:" output.txt || echo "Summary section not found in output"
53+
5154
# Always display the summary clearly
5255
echo "### URL Check Results" >> $GITHUB_STEP_SUMMARY
5356
if [ $EXIT_CODE -eq 0 ]; then
@@ -68,14 +71,24 @@ jobs:
6871
if: always()
6972
run: rm -rf scripts/python/url-checker/__pycache__
7073

71-
- name: Debug values
74+
- name: Determine if workflow should fail
75+
id: determine_fail
76+
if: steps.check_links.outputs.link_check_exit_code != '0'
77+
run: |
78+
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
79+
echo "should_fail=true" >> $GITHUB_OUTPUT
80+
else
81+
echo "should_fail=${{ github.event.inputs.fail-on-broken-links }}" >> $GITHUB_OUTPUT
82+
fi
83+
84+
- name: Debug workflow info
85+
if: steps.check_links.outputs.link_check_exit_code != '0'
7286
run: |
73-
echo "Event name: ${{ github.event_name }}"
74-
echo "Input fail-on-broken-links: ${{ github.event.inputs.fail-on-broken-links }}"
75-
echo "Link check exit code: ${{ steps.check_links.outputs.link_check_exit_code }}"
87+
echo "Exit code: ${{ steps.check_links.outputs.link_check_exit_code }}"
88+
echo "SHOULD_FAIL: ${{ steps.determine_fail.outputs.should_fail }}"
7689
77-
- name: Force workflow failure
78-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.fail-on-broken-links == 'true' && steps.check_links.outputs.link_check_exit_code != '0' }}
90+
- name: Report final status
91+
if: steps.check_links.outputs.link_check_exit_code != '0' && steps.determine_fail.outputs.should_fail == 'true'
7992
run: |
80-
echo "::error::Broken links were found in the documentation and fail-on-broken-links is set to true."
93+
echo "::error::Broken links were found in the documentation. See uploaded logs for details."
8194
exit 1

0 commit comments

Comments
 (0)