Files
MaaAssistantArknights/.github/workflows/markdown-checker.yml
2026-06-28 13:24:55 +08:00

65 lines
2.0 KiB
YAML

name: Markdown Link Check
on:
schedule:
- cron: "0 0 * * 2" # Every Tuesday at 00:00 UTC
push:
branches:
- dev-v2
paths:
- ".github/workflows/markdown-checker.yml"
- "docs/**"
- "**/*.md"
pull_request:
branches:
- dev-v2
paths:
- ".github/workflows/markdown-checker.yml"
- "docs/**"
- "**/*.md"
workflow_dispatch:
jobs:
check-links:
name: Check Dead Links
if: github.repository_owner == 'MaaAssistantArknights' && github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com'
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
show-progress: false
- name: Cache lychee responses
uses: actions/cache@v6
continue-on-error: true
with:
path: .lycheecache
key: lychee-cache
- name: Check dead internal links
uses: lycheeverse/lychee-action@v2
with:
# 仅检查内部链接,排除所有外部链接
args: >
--root-dir ./docs/.vuepress/public
--verbose --no-progress
--cache --max-cache-age 1d --cache-exclude-status '429, 500..599'
--exclude 'https?://.*'
--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: failure() && github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v3
with:
message: |
Dead links found in the documentation. Please fix them.
Details: https://github.com/MaaAssistantArknights/MaaAssistantArknights/actions/runs/${{ github.run_id }}