Skip to content

Commit 7475ece

Browse files
committed
chore(ci): check for broken links in docs
1 parent b1b526a commit 7475ece

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/check.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,52 @@ jobs:
110110
npm ci --force
111111
npm run lint
112112
npm run build
113+
114+
- name: Run Lychee Link Checker
115+
id: lychee
116+
uses: lycheeverse/lychee-action@v2.8.0
117+
with:
118+
fail: false
119+
args: >
120+
--base-url https://docs.apify.com
121+
--max-retries 6
122+
--exclude="github.com"
123+
--exclude="npmjs.com"
124+
--no-progress
125+
--timeout '60'
126+
--accept '100..=103,200..=299,429'
127+
--max-redirects 5
128+
--format markdown
129+
'./website/build/**/*.html'
130+
131+
- name: Find Comment
132+
if: github.event_name == 'pull_request'
133+
uses: peter-evans/find-comment@v3
134+
id: find-comment
135+
with:
136+
issue-number: ${{ github.event.pull_request.number }}
137+
body-includes: There are broken links in the documentation.
138+
139+
- name: Links are passing
140+
if: github.event_path == 'pull_request' && steps.lychee.outputs.exit_code == 0 && steps.find-comment.outputs.comment-id
141+
uses: peter-evans/create-or-update-comment@v5
142+
with:
143+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
144+
issue-number: ${{ github.event.pull_request.number }}
145+
body: |
146+
✅ The link checker did not find any broken links.
147+
148+
See more at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#summary-${{ job.check_run_id }}
149+
edit-mode: replace
150+
151+
- name: Links are failing
152+
if: github.event_path == 'pull_request' && steps.lychee.outputs.exit_code != 0
153+
uses: peter-evans/create-or-update-comment@v5
154+
with:
155+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
156+
issue-number: ${{ github.event.pull_request.number }}
157+
body: |
158+
⚠️ There are broken links in the documentation.
159+
160+
See more at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#summary-${{ job.check_run_id }}
161+
edit-mode: replace

0 commit comments

Comments
 (0)