Skip to content

Commit

Permalink
ci:add check links (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
CritasWang authored Jan 7, 2025
1 parent 319ac02 commit 184851e
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/site-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ jobs:
env:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm build

linksCheck:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: pnpm install

- name: Test build website
env:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm run check-links

deploy:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"scripts": {
"build": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src",
"check-links": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src -c ./src/.vuepress/config_check_links.ts",
"clean-dev": "vuepress dev src --clean-cache",
"dev": "vuepress dev src",
"update-package": "npx vp-update",
Expand All @@ -23,6 +24,7 @@
"@vuepress/bundler-vite": "2.0.0-rc.19",
"@vuepress/helper": "2.0.0-rc.66",
"@vuepress/plugin-docsearch": "2.0.0-rc.67",
"@vuepress/plugin-links-check": "2.0.0-rc.68",
"mathjax-full": "3.2.2",
"sass-embedded": "1.83.0",
"vue": "3.5.13",
Expand Down
68 changes: 68 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions src/.vuepress/config_check_links.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { linksCheckPlugin } from '@vuepress/plugin-links-check'
import { defineUserConfig } from 'vuepress';
import config from './config.js';

if(config.plugins === undefined) config.plugins = [];
config.plugins = [...config.plugins,linksCheckPlugin({build: 'error'})];

export default defineUserConfig(config);

0 comments on commit 184851e

Please sign in to comment.