From 3f20765c4a75615960335bd2a6dad262b67d126e Mon Sep 17 00:00:00 2001 From: Adnan Hasnat <78582230+Tridecatrix@users.noreply.github.com> Date: Thu, 17 Oct 2024 18:54:25 +1100 Subject: [PATCH] Port Lychee link checker to user documentation (#531) --- .github/workflows/check-links.yaml | 37 +++++++++++++++++++++++------- .lycheeignore | 16 +++++++++++++ mlc_config.json | 31 ------------------------- 3 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 .lycheeignore delete mode 100644 mlc_config.json diff --git a/.github/workflows/check-links.yaml b/.github/workflows/check-links.yaml index 648e7558e..1603a1832 100644 --- a/.github/workflows/check-links.yaml +++ b/.github/workflows/check-links.yaml @@ -1,16 +1,37 @@ -name: Check Markdown links +name: Check external href links in the documentation on: + push: + paths: + - '.github/workflows/check-links.yml' + - '.lycheeignore' + - 'lychee.toml' + - '**/*.md' + schedule: + # Run on the first of each month at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) + - cron: "0 9 1 * *" workflow_dispatch: +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" + cancel-in-progress: true + jobs: - markdown-link-check: + lychee: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 + - uses: actions/checkout@v4 + with: + show-progress: 'false' + - name: Restore lychee cache + uses: actions/cache@v4 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2.0.2 with: - use-quiet-mode: 'yes' - use-verbose-mode: 'no' - config-file: 'mlc_config.json' - folder-path: 'en' + fail: true + args: --accept '200,201,202,203,204,403,429,500' --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md' \ No newline at end of file diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 000000000..06d882b58 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,16 @@ +https://arxiv.org/ +https://chrome.google.com/ +https://contribute.jabref.org/ +https://donations.jabref.org/ +https://pubs.acs.org/ +https://scholar.archive.org/ +https://web.archive.org/ +https://www.researchgate.net/privacy-policy +https://www.sciencedirect.com/ + +https://github.com/koppor/jabref/issue +https://github.com/koppor/jabref/pull +https://github.com/JabRef/jabref/issue +https://github.com/JabRef/jabref/pull + +0005-example.md \ No newline at end of file diff --git a/mlc_config.json b/mlc_config.json deleted file mode 100644 index 3c775a554..000000000 --- a/mlc_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^https://.*\\.crossref\\.org" - }, - { - "pattern": "^https://.*\\.github\\.com" - }, - { - "pattern": "^https://dl\\.acm\\.org" - }, - { - "pattern": "^http://purl\\.org/net/bibteXMP" - }, - { - "pattern": "^https://.*\\.jabref\\.org" - }, - { - "pattern": "\\.tex\\.ac\\.uk/" - }, - { - "pattern": "gitignore\\.io" - }, - { - "pattern": "en\\.wikipedia\\.org" - }, - { - "pattern": "^https://web.archive.org/" - } - ] -}