mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
ci: use lychee to check dead links (#9675)
* ci: use lychee to check dead links * ci: comment on PR when dead links are found * docs: fix broken links
This commit is contained in:
72
.github/workflows/markdown-checker.yml
vendored
72
.github/workflows/markdown-checker.yml
vendored
@@ -2,15 +2,21 @@ name: Lint Markdown files
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
- "docs/**"
|
||||
- ".github/workflows/markdown-checker.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
- "docs/**"
|
||||
- ".github/workflows/markdown-checker.yml"
|
||||
schedule:
|
||||
- cron: "44 7 * * 2"
|
||||
- cron: "44 7 * * 2" # Every Tuesday at 7:44 AM UTC
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -31,19 +37,47 @@ jobs:
|
||||
README.md
|
||||
docs/**/*.md
|
||||
|
||||
# check-links:
|
||||
# name: Check Dead Links
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out code
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# show-progress: false
|
||||
#
|
||||
# - name: Check Dead Link
|
||||
# uses: umbrelladocs/action-linkspector@v1
|
||||
# with:
|
||||
# # Use github-pr-review when triggered by a pull request; otherwise, use github-check
|
||||
# reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
|
||||
# filter_mode: nofilter
|
||||
# fail_on_error: true
|
||||
check-links:
|
||||
name: Check Dead Links
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Cache lychee
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .lycheecache
|
||||
key: cache-lychee-${{ github.sha }}
|
||||
restore-keys: cache-lychee-
|
||||
|
||||
- name: Check dead links
|
||||
uses: lycheeverse/lychee-action@v1
|
||||
with:
|
||||
# 主要用于检查相对链接,对于 Github Actions 无法访问的网站,或者失效的外部网站,可以通过 --exclude 参数排除
|
||||
args: >
|
||||
--verbose --no-progress --cache --max-cache-age 1d
|
||||
--exclude 'https://map\.ark-nights\.com/areas'
|
||||
--exclude 'https://.*\.maa-org\.net/.*'
|
||||
--exclude 'https://support\.bluestacks\.com/.*'
|
||||
--exclude 'https://www\.bigfun\.cn/.*'
|
||||
--exclude 'https://myqqbot\.com/.*'
|
||||
--exclude 'http://xn--2qqv08bx5e\.com/'
|
||||
--exclude-path 'docs/zh-tw/manual/introduction/introduction_old.md'
|
||||
--exclude-path 'docs/ja-jp/manual/introduction/introduction_old.md'
|
||||
-- './docs/**/*.md' './README.md'
|
||||
|
||||
- name: Comment (only for PR)
|
||||
if: github.event_name == 'pull_request' && env.lychee_exit_code != 0
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
message: |
|
||||
Dead links found in the documentation. Please fix them.
|
||||
Details: https://github.com/MaaAssistantArknights/MaaAssistantArknights/actions/runs/${{ github.run_id }}
|
||||
|
||||
- name: Exit with lychee exit code
|
||||
run: exit ${{ env.lychee_exit_code }}
|
||||
|
||||
Reference in New Issue
Block a user