Skip to content

Commit 20a9fdc

Browse files
committed
[CI] Add lychee link checker workflow
1 parent 7eea9ed commit 20a9fdc

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/links.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# To run similar tasks locally, install lychee and run the following at the root of the repository:
19+
# lychee .
20+
21+
name: Links
22+
23+
on:
24+
repository_dispatch:
25+
workflow_dispatch:
26+
pull_request:
27+
schedule:
28+
- cron: '9 1 * * 0' # At 01:09 on Sunday.
29+
30+
jobs:
31+
check-links:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
issues: write # required for Broken Links Report
35+
steps:
36+
- uses: actions/checkout@v6
37+
with:
38+
persist-credentials: false
39+
- name: Link Checker
40+
id: lychee
41+
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
42+
with:
43+
args: --config lychee.toml .
44+
fail: false
45+
46+
- name: Broken Links Report
47+
if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule'
48+
uses: actions/github-script@v8
49+
with:
50+
script: |
51+
const fs = require('fs');
52+
53+
// Read the markdown file
54+
// Ensure the path is correct relative to the workspace root
55+
const reportBody = fs.readFileSync('./lychee/out.md', 'utf8');
56+
57+
await github.rest.issues.create({
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
title: 'Broken Links Report',
61+
body: reportBody
62+
});

lychee.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
exclude = [
19+
"https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.1/html/Release_Notes/version-4.2.html#issues-fixed-4.2.1",
20+
"https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.0/html/Release_Notes/index.html",
21+
"https://cloudstack.apache.org/survey.html",
22+
"https://downloads.chef.io/chef-dk/",
23+
"https://github.com/YOUR_ACCOUNT/cloudstack",
24+
"https://iconka.com/en/downloads/cat-power/",
25+
"https://issues.apache.org/.*",
26+
"http://localhost:5050/",
27+
"https://markmail.org/.*",
28+
"https://viserjs.github.io/docs.html#/viser/guide/installation"]

0 commit comments

Comments
 (0)