6
6
schedule :
7
7
- cron : " 0 18 * * *"
8
8
9
+ env :
10
+ BUILD_PATH : " ."
11
+
9
12
jobs :
10
13
check_links :
11
14
runs-on : ubuntu-latest
12
15
steps :
13
- - uses : actions/checkout@v4
16
+ - name : Checkout
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Setup pnpm
20
+ uses : pnpm/action-setup@v4
21
+
22
+ - name : Setup Node
23
+ uses : actions/setup-node@v4
24
+ with :
25
+ node-version : " 20"
26
+ cache : " pnpm"
27
+ cache-dependency-path : ${{ env.BUILD_PATH }}/pnpm-lock.yaml
28
+
29
+ - name : Install dependencies
30
+ run : pnpm install --frozen-lockfile
31
+ working-directory : ${{ env.BUILD_PATH }}
32
+
33
+ - name : Build with Astro
34
+ run : pnpm build --site "http://localhost:4321"
35
+ working-directory : ${{ env.BUILD_PATH }}
36
+
37
+ - name : Start Astro Preview in the background
38
+ run : |
39
+ pnpm preview &
40
+ echo $! > astro-preview.pid
41
+ working-directory : ${{ env.BUILD_PATH }}
42
+
43
+ - name : Wait for Astro to be ready
44
+ run : |
45
+ timeout 15 sh -c 'until curl -s http://localhost:4321 > /dev/null; do sleep 1; done'
14
46
15
47
- name : Link Checker
16
48
id : lychee
17
49
uses : lycheeverse/lychee-action@v1
18
50
with :
19
- args : --base . --verbose --no-progress './**/*.md' './**/*.mdx' './**/*.html' './**/*.rst'
51
+ args : --base ${{ env.BUILD_PATH }}/dist --verbose --no-progress --remap 'file:///home/runner/work/r.obin.ch/r.obin.ch/dist http://localhost:4321' './**/*.html'
52
+
53
+ - name : Stop Astro Preview
54
+ run : kill $(cat astro-preview.pid)
20
55
21
56
- name : Find or Create Issue
22
57
id : issue_finder
@@ -39,13 +74,21 @@ jobs:
39
74
owner: context.repo.owner,
40
75
repo: context.repo.repo,
41
76
title: 'Link Checker Report',
42
- body: 'This issue tracks the broken links found by the link checker .',
77
+ body: 'There are no broken links in the site or action did not run successfully .',
43
78
labels: ['report', 'automated issue'],
44
79
});
45
80
issue = newIssue;
46
81
console.log(`Created issue #${newIssue.number}`);
47
82
} else {
48
- console.log(`Found existing issue #${issue.number}`);
83
+ // If an issue with the title "Link Checker Report" already exists, update its body
84
+ const { data: updatedIssue } = await github.rest.issues.update({
85
+ owner: context.repo.owner,
86
+ repo: context.repo.repo,
87
+ issue_number: issue.number,
88
+ body: 'There are no broken links in the site or action did not run successfully.',
89
+ });
90
+ issue = updatedIssue;
91
+ console.log(`Updated issue #${issue.number}`);
49
92
}
50
93
51
94
// Output the issue number to pass to the next steps
0 commit comments