Unverified Commit b40aa3e6 authored by Dmitry Tokarev's avatar Dmitry Tokarev Committed by GitHub
Browse files

fix: lychee cache - don't cache failures, save cache on main for every run...


fix: lychee cache - don't cache failures, save cache on main for every run after sanitizing it. (#6824)
Signed-off-by: default avatarDmitry Tokarev <dtokarev@nvidia.com>
Co-authored-by: default avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 62ec9f5b
...@@ -13,16 +13,16 @@ jobs: ...@@ -13,16 +13,16 @@ jobs:
lychee: lychee:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
# Cache lychee results (e.g. to avoid hitting rate limits)
# https://lychee.cli.rs/github_action_recipes/caching/
- name: Restore lychee cache - name: Restore lychee cache
uses: actions/cache@v4 id: restore-cache
uses: actions/cache/restore@v5
with: with:
path: .lycheecache path: .lycheecache
key: cache-lychee-${{ github.sha }} key: cache-lychee-${{ github.run_id }}
restore-keys: cache-lychee- restore-keys: cache-lychee-
- name: Check documentation links with lychee - name: Check documentation links with lychee
...@@ -42,12 +42,39 @@ jobs: ...@@ -42,12 +42,39 @@ jobs:
--accept "200..=299, 403, 429" --accept "200..=299, 403, 429"
--exclude-all-private --exclude-all-private
--exclude 0.0.0.0 --exclude 0.0.0.0
${{ github.event_name == 'pull_request' && '--offline' || '' }} -v
--host-concurrency 10
--host-request-interval 1s
--host-stats
${{ github.event_name == 'pull_request' && '--offline' || '' }}
. .
fail: true fail: true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Strip cached errors before saving
if: always() && github.ref == 'refs/heads/main'
run: |
if [ -f .lycheecache ]; then
grep -E ',2[0-9]{2},' .lycheecache > .lycheecache.tmp || true
cutoff=$(( $(date +%s) - 93600 ))
stale=$(awk -F',' -v c="$cutoff" '$3 < c' .lycheecache.tmp)
if [ -n "$stale" ]; then
echo "Removing stale cache entries (>26h old):"
echo "$stale"
awk -F',' -v c="$cutoff" '$3 >= c' .lycheecache.tmp > .lycheecache.tmp2 || true
mv .lycheecache.tmp2 .lycheecache.tmp
fi
mv .lycheecache.tmp .lycheecache
fi
- name: Save lychee cache
uses: actions/cache/save@v5
if: always() && github.ref == 'refs/heads/main'
with:
path: .lycheecache
key: cache-lychee-${{ github.run_id }}
broken-links-check: broken-links-check:
name: Check for broken markdown links name: Check for broken markdown links
runs-on: ubuntu-latest runs-on: ubuntu-latest
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment