Commit 4c15e4b
authored
fix: make link checker workflow more robust to handle no-changes scenario (#1545)
## Description
This PR fixes the link checker workflow that was failing in [run
#17112443036](https://github.com/wandb/docs/actions/runs/17112443036/job/48536639778#step:7:1)
when there were no auto-fixable changes to commit.
## Problem
The `peter-evans/create-pull-request` action fails when there are no
changes to commit. This happens when:
- All broken links require manual intervention (true 404s)
- No broken links are found
- The lychee checker finds links but none can be auto-fixed
## Solution
1. **Added change detection**: The workflow now checks if there are
actual file changes before attempting to create a PR
2. **Conditional PR creation**: Only creates a PR if there are
auto-fixed changes
3. **Issue creation fallback**: When there are no auto-fixes but manual
fixes are needed, creates an issue instead
4. **Workflow summary**: Added a summary step to clearly show what
actions were taken
## Changes Made
- Modified `.github/workflows/linkcheck.yml` to:
- Check for file changes using `git status --porcelain`
- Check if a report was generated
- Only create PR when `has_changes=true`
- Create an issue when `has_changes=false` but `has_report=true` and
manual fixes are needed
- Add a summary step that shows what happened in the workflow run
## Testing
Tested locally using the `.github/test-link-checker.sh` script to
verify:
- ✅ Auto-fixes are applied when possible
- ✅ Report is generated correctly
- ✅ Change detection logic works
- ✅ Generated reference docs are skipped
## Expected Behavior
After this fix:
- If auto-fixable links are found → Creates PR with fixes
- If only manual fixes needed → Creates issue with report
- If no broken links → Workflow succeeds with summary
- No more workflow failures due to "nothing to commit"1 parent d142557 commit 4c15e4b
1 file changed
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
| 61 | + | |
47 | 62 | | |
48 | 63 | | |
49 | 64 | | |
| |||
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
0 commit comments