From c3130b87b007e4fd214e3a87566dc616f99bd470 Mon Sep 17 00:00:00 2001 From: Matt Linville Date: Mon, 27 Jan 2025 12:46:34 -0800 Subject: [PATCH 1/4] Try to fix Lychee github action error --- .github/workflows/linkcheck.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 1508a35cd..74cebac5c 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -1,10 +1,29 @@ name: Lychee check on: pull_request: - paths: - - '**.md' jobs: + linkChecker: + runs-on: ubuntu-latest + permissions: + issues: write # required for peter-evans/create-issue-from-file + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false + + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue + lychee: runs-on: ubuntu-latest steps: @@ -21,11 +40,7 @@ jobs: uses: lycheeverse/lychee-action@v1.10.0 with: token: ${{ secrets.GITHUB_TOKEN }} - args: > - --scheme https --scheme http --verbose --no-cache - --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" - --max-concurrency 5 --retry-count 3 --retry-delay 2 - ${{ steps.changed-files.outputs.all_changed_files }} + args: --base content --scheme https --scheme http --verbose --no-cache --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" --max-concurrency 5 --retry-count 3 --retry-delay 2 ${{ steps.changed-files.outputs.all_changed_files }} env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From c7ee2135d087af9e54a428d0451a4279a9cc9f11 Mon Sep 17 00:00:00 2001 From: Matt Linville Date: Tue, 28 Jan 2025 14:39:41 -0800 Subject: [PATCH 2/4] Adjust args, schedule for testing --- .github/workflows/linkcheck.yml | 70 ++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 74cebac5c..64e5f57ed 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -1,6 +1,9 @@ name: Lychee check on: - pull_request: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "41 14 * * *" jobs: linkChecker: @@ -8,45 +11,58 @@ jobs: permissions: issues: write # required for peter-evans/create-issue-from-file steps: - - uses: actions/checkout@v4 - - - name: Link Checker - id: lychee - uses: lycheeverse/lychee-action@v2 - with: - fail: false - - - name: Create Issue From File - if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v5 + # Cache lychee results (e.g. to avoid hitting rate limits) + - name: Restore lychee cache + uses: actions/cache@v4 with: - title: Link Checker Report - content-filepath: ./lychee/out.md - labels: report, automated issue - - lychee: - runs-on: ubuntu-latest - steps: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + # check URLs with Lychee - uses: actions/checkout@v4 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 with: - files: "**.md" + files: "content/**.md" - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.10.0 + uses: lycheeverse/lychee-action@v2 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --base content --scheme https --scheme http --verbose --no-cache --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" --max-concurrency 5 --retry-count 3 --retry-delay 2 ${{ steps.changed-files.outputs.all_changed_files }} + args: >- + --accept 200,429 + --base content + --cache + --max-cache-age 1d + --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + --max-concurrency 5 + --verbose + --no-progress + --retry-count 1 + --retry-delay 2 + --scheme https + --scheme http + './content/*.md' + './content/*.html' + fail: false env: + # to be used in case rate limits are surpassed GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Create PR comment with link reults - uses: marocchino/sticky-pull-request-comment@v2 + - name: Save lychee cache + uses: actions/cache/save@v3 + if: always() with: - header: lychee - recreate: true - path: ./lychee/out.md \ No newline at end of file + path: .lycheecache + key: ${{ steps.restore-cache.outputs.cache-primary-key }} + + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue From f03d8cc76af9f04d5abd7609c99197396f849f5e Mon Sep 17 00:00:00 2001 From: Matt Linville Date: Thu, 30 Jan 2025 14:29:30 -0800 Subject: [PATCH 3/4] Revert caching steps, adjust schedule --- .github/workflows/linkcheck.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 64e5f57ed..57aa626b2 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -3,7 +3,7 @@ on: repository_dispatch: workflow_dispatch: schedule: - - cron: "41 14 * * *" + - cron: "1 0 1 * *" # 12:01 on the 1st of each month jobs: linkChecker: @@ -11,13 +11,6 @@ jobs: permissions: issues: write # required for peter-evans/create-issue-from-file steps: - # Cache lychee results (e.g. to avoid hitting rate limits) - - name: Restore lychee cache - uses: actions/cache@v4 - with: - path: .lycheecache - key: cache-lychee-${{ github.sha }} - restore-keys: cache-lychee- # check URLs with Lychee - uses: actions/checkout@v4 @@ -35,7 +28,7 @@ jobs: args: >- --accept 200,429 --base content - --cache + --no-cache --max-cache-age 1d --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" --max-concurrency 5 @@ -52,13 +45,6 @@ jobs: # to be used in case rate limits are surpassed GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Save lychee cache - uses: actions/cache/save@v3 - if: always() - with: - path: .lycheecache - key: ${{ steps.restore-cache.outputs.cache-primary-key }} - - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 uses: peter-evans/create-issue-from-file@v5 From 7b5b014f4e1f532bda4d735a5e56cf87b1d30097 Mon Sep 17 00:00:00 2001 From: Matt Linville Date: Fri, 31 Jan 2025 14:01:10 -0800 Subject: [PATCH 4/4] Update .github/workflows/linkcheck.yml --- .github/workflows/linkcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 57aa626b2..d88d7a104 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -3,7 +3,7 @@ on: repository_dispatch: workflow_dispatch: schedule: - - cron: "1 0 1 * *" # 12:01 on the 1st of each month + - cron: "1 0 2 * *" # 12:01 on the 1st of each month jobs: linkChecker: