Skip to content

Commit f6b0a04

Browse files
authored
Merge branch 'main' into sekyondaMeta-StalePRs-update
2 parents f89bfc6 + 18abd43 commit f6b0a04

File tree

1 file changed

+9
-42
lines changed

1 file changed

+9
-42
lines changed

.github/workflows/link_checkPR.yml

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,26 @@
11
#Checks links in a PR to ensure they are valid. If link is valid but failing, it can be added to the .lycheeignore file
2-
#Code source: https://github.com/lycheeverse/lychee-action/issues/238
32

43
name: link check on PR
54

65
on:
76
pull_request:
87
branches: [main]
9-
108
jobs:
11-
check-links:
9+
linkChecker:
1210
runs-on: ubuntu-latest
1311
steps:
14-
- name: Clone repository
15-
uses: actions/checkout@v4
12+
- uses: actions/checkout@v4
1613
with:
17-
fetch-depth: 0
18-
ref: ${{github.event.pull_request.head.ref}}
19-
repository: ${{github.event.pull_request.head.repo.full_name}}
20-
21-
- name: Check out main branch
22-
run: git checkout main
23-
24-
- name: Dump all links from main
25-
id: dump_links_from_main
14+
fetch-depth: 1
15+
- name: Get Changed Files
16+
id: changed-files
17+
uses: tj-actions/changed-files@v34
18+
- name: Check Links
2619
uses: lycheeverse/lychee-action@v1
2720
with:
28-
args: |
29-
--dump
30-
--include-fragments
31-
.
32-
output: ./links-main.txt
33-
34-
- name: Stash untracked files
35-
run: git stash push --include-untracked
36-
37-
- name: Check out feature branch
38-
run: git checkout ${{ github.head_ref }}
39-
40-
- name: Apply stashed changes
41-
# Apply stashed changes, ignore errors if stash is empty
42-
run: git stash pop || true
43-
44-
- name: Append links-main.txt to .lycheeignore
45-
run: cat links-main.txt >> .lycheeignore
46-
47-
- name: Check links
48-
uses: lycheeverse/lychee-action@v1
49-
with:
50-
args: |
51-
--no-progress
52-
--include-fragments
53-
.
54-
# Fail action on broken links
21+
args: --accept=200,403,429 --base . --verbose --no-progress ${{ steps.changed-files.outputs.all_changed_files }}
22+
token: ${{ secrets.CUSTOM_TOKEN }}
5523
fail: true
56-
5724
- name: Suggestions
5825
if: failure()
5926
run: |

0 commit comments

Comments
 (0)