From 58fdf2a692aaa5a193e03c62d94f5ce0034ebeda Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 11 Dec 2024 08:10:41 +0100 Subject: [PATCH] Cache successful requests in lychee (#6030) This does the same as we do in contrib, which is to cache successful requests in lychee, so errors such as 429s have less changes of occurring. --- .github/workflows/links-fail-fast.yml | 12 ++++++++++-- .github/workflows/links.yml | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 94e1996ff..080c861e4 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -13,7 +13,8 @@ jobs: - uses: actions/checkout@v4 - name: Restore lychee cache - uses: actions/cache@v4 + uses: actions/cache/restore@v4 + id: cache-restore with: path: .lycheecache key: cache-lychee-${{ github.sha }} @@ -25,4 +26,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: fail: true - args: --max-concurrency 5 --cache --max-cache-age 1d . + args: --max-concurrency 5 --cache --max-cache-age 1d --cache-exclude-status 300..=599 . + + - name: Save lychee cache + if: always() + uses: actions/cache/save@v4 + with: + path: .lycheecache + key: ${{ steps.cache-restore.outputs.cache-primary-key }} diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 83c3b61b8..f96559ccd 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -18,7 +18,8 @@ jobs: - name: Restore lychee cache - uses: actions/cache@v4 + uses: actions/cache/restore@v4 + id: cache-restore with: path: .lycheecache key: cache-lychee-${{ github.sha }} @@ -30,7 +31,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: --max-concurrency 1 --cache --max-cache-age 1d . + args: --max-concurrency 1 --cache --max-cache-age 1d --cache-exclude-status 300..=599 . + + - name: Save lychee cache + if: always() + uses: actions/cache/save@v4 + with: + path: .lycheecache + key: ${{ steps.cache-restore.outputs.cache-primary-key }} - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0