7
7
branches :
8
8
- canary
9
9
- main
10
- # Enable manual triggering from GitHub Actions tab
11
10
workflow_dispatch :
12
11
inputs :
13
12
fail-on-broken-links :
@@ -42,12 +41,16 @@ jobs:
42
41
43
42
- name : Check for broken links
44
43
id : check_links
45
- continue-on-error : true
46
44
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
+
51
54
# Always display the summary clearly
52
55
echo "### URL Check Results" >> $GITHUB_STEP_SUMMARY
53
56
if [ $EXIT_CODE -eq 0 ]; then
@@ -68,14 +71,24 @@ jobs:
68
71
if : always()
69
72
run : rm -rf scripts/python/url-checker/__pycache__
70
73
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'
72
86
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 }}"
76
89
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'
79
92
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 ."
81
94
exit 1
0 commit comments