Skip to content

Commit 184851e

Browse files
authored
ci:add check links (#506)
1 parent 319ac02 commit 184851e

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed

.github/workflows/site-build.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ jobs:
3737
env:
3838
NODE_OPTIONS: --max_old_space_size=8192
3939
run: pnpm build
40+
41+
linksCheck:
42+
runs-on: ubuntu-latest
43+
if: github.event_name == 'pull_request'
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install pnpm
49+
uses: pnpm/action-setup@v4
50+
51+
- name: Use Node.js 22
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: 22
55+
56+
- name: Install dependencies
57+
run: pnpm install
58+
59+
- name: Test build website
60+
env:
61+
NODE_OPTIONS: --max_old_space_size=8192
62+
run: pnpm run check-links
4063

4164
deploy:
4265
runs-on: ubuntu-latest

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
],
1313
"scripts": {
1414
"build": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src",
15+
"check-links": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src -c ./src/.vuepress/config_check_links.ts",
1516
"clean-dev": "vuepress dev src --clean-cache",
1617
"dev": "vuepress dev src",
1718
"update-package": "npx vp-update",
@@ -23,6 +24,7 @@
2324
"@vuepress/bundler-vite": "2.0.0-rc.19",
2425
"@vuepress/helper": "2.0.0-rc.66",
2526
"@vuepress/plugin-docsearch": "2.0.0-rc.67",
27+
"@vuepress/plugin-links-check": "2.0.0-rc.68",
2628
"mathjax-full": "3.2.2",
2729
"sass-embedded": "1.83.0",
2830
"vue": "3.5.13",

pnpm-lock.yaml

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import { linksCheckPlugin } from '@vuepress/plugin-links-check'
20+
import { defineUserConfig } from 'vuepress';
21+
import config from './config.js';
22+
23+
if(config.plugins === undefined) config.plugins = [];
24+
config.plugins = [...config.plugins,linksCheckPlugin({build: 'error'})];
25+
26+
export default defineUserConfig(config);

0 commit comments

Comments
 (0)