From c937937c7432df8f57956e4dcf9cf3a7e46403d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Olender?= <92638966+TC-MO@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:57:43 +0200 Subject: [PATCH 1/4] rework lychee action so it works periodically instead of at every PR --- .github/workflows/lychee.yml | 85 +++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index e5d2192a07..0beebbd2ec 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -1,36 +1,61 @@ -name: Lychee Link Checker +name: Periodic Link Checker -on: [ pull_request ] +on: + schedule: + - cron: '0 0 */3 * *' # Run every 3 days at midnight UTC + workflow_dispatch: # Allow manual triggering jobs: - link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'package-lock.json' - always-auth: 'true' - registry-url: 'https://npm.pkg.github.com/' - scope: '@apify-packages' + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + cache-dependency-path: 'package-lock.json' + always-auth: 'true' + registry-url: 'https://npm.pkg.github.com/' + scope: '@apify-packages' - - name: Build docs - run: | - npm ci --force - npm update @apify/openapi - npm run build - env: - APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} + - name: Build docs + run: | + npm ci --force + npm update @apify/openapi + npm run build + env: + APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} - - uses: lycheeverse/lychee-action@v1.10.0 - env: - GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - with: - fail: true - args: --base https://docs.apify.com --exclude-path 'build/versions.html' --max-retries 6 --verbose --no-progress --accept '100..=103,200..=299,403..=403, 429' './build/**/*.html' + - name: Run Lychee Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1.10.0 + env: + GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + with: + fail: false # Changed to false so the workflow doesn't fail on broken links + args: > + --base https://docs.apify.com + --exclude-path 'build/versions.html' + --max-retries 6 + --verbose + --no-progress + --accept '100..=103,200..=299,403..=403,429' + --output ./lychee/out.md + --format markdown + './build/**/*.html' + + - name: Upload report as artifact + uses: actions/upload-artifact@v3 + if: always() + with: + name: Link Checker Report + path: ./lychee/out.md + + - name: Add job summary + if: always() + run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY From c99f50414ecc5076c17b1946aa65004b6b434728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Olender?= <92638966+TC-MO@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:06:16 +0200 Subject: [PATCH 2/4] change frequency to daily at midnight UTC --- .github/workflows/lychee.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index 0beebbd2ec..faa7c24d98 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -2,7 +2,7 @@ name: Periodic Link Checker on: schedule: - - cron: '0 0 */3 * *' # Run every 3 days at midnight UTC + - cron: '0 0 * * *' # Run daily at midnight UTC workflow_dispatch: # Allow manual triggering jobs: @@ -37,7 +37,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} with: - fail: false # Changed to false so the workflow doesn't fail on broken links + fail: false args: > --base https://docs.apify.com --exclude-path 'build/versions.html' @@ -48,13 +48,7 @@ jobs: --output ./lychee/out.md --format markdown './build/**/*.html' - - - name: Upload report as artifact - uses: actions/upload-artifact@v3 - if: always() - with: - name: Link Checker Report - path: ./lychee/out.md + continue-on-error: true - name: Add job summary if: always() From 0195c13d426da2d538a1023333e734791300f019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Olender?= <92638966+TC-MO@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:42:06 +0200 Subject: [PATCH 3/4] fix formatting in .yml file --- .github/workflows/lychee.yml | 92 ++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index faa7c24d98..9b6216dfd8 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -1,55 +1,55 @@ name: Periodic Link Checker on: - schedule: - - cron: '0 0 * * *' # Run daily at midnight UTC - workflow_dispatch: # Allow manual triggering + schedule: + - cron: '0 0 * * *' # Run daily at midnight UTC + workflow_dispatch: # Allow manual triggering jobs: - link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'package-lock.json' - always-auth: 'true' - registry-url: 'https://npm.pkg.github.com/' - scope: '@apify-packages' + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + cache-dependency-path: 'package-lock.json' + always-auth: 'true' + registry-url: 'https://npm.pkg.github.com/' + scope: '@apify-packages' - - name: Build docs - run: | - npm ci --force - npm update @apify/openapi - npm run build - env: - APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} + - name: Build docs + run: | + npm ci --force + npm update @apify/openapi + npm run build + env: + APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} - - name: Run Lychee Link Checker - id: lychee - uses: lycheeverse/lychee-action@v1.10.0 - env: - GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - with: - fail: false - args: > - --base https://docs.apify.com - --exclude-path 'build/versions.html' - --max-retries 6 - --verbose - --no-progress - --accept '100..=103,200..=299,403..=403,429' - --output ./lychee/out.md - --format markdown - './build/**/*.html' - continue-on-error: true + - name: Run Lychee Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1.10.0 + env: + GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + with: + fail: false + args: > + --base https://docs.apify.com + --exclude-path 'build/versions.html' + --max-retries 6 + --verbose + --no-progress + --accept '100..=103,200..=299,403..=403,429' + --output ./lychee/out.md + --format markdown + './build/**/*.html' + continue-on-error: true - - name: Add job summary - if: always() - run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY + - name: Add job summary + if: always() + run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY From 18d08b2d02802a0fa2805840197e6d3baf08ba01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Olender?= <92638966+TC-MO@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:47:53 +0200 Subject: [PATCH 4/4] fix formatting --- .github/workflows/lychee.yml | 82 ++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index 9b6216dfd8..45c6299858 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -2,54 +2,54 @@ name: Periodic Link Checker on: schedule: - - cron: '0 0 * * *' # Run daily at midnight UTC + - cron: '0 0 * * *' # Run daily at midnight UTC workflow_dispatch: # Allow manual triggering jobs: link-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'package-lock.json' - always-auth: 'true' - registry-url: 'https://npm.pkg.github.com/' - scope: '@apify-packages' + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + cache-dependency-path: 'package-lock.json' + always-auth: 'true' + registry-url: 'https://npm.pkg.github.com/' + scope: '@apify-packages' - - name: Build docs - run: | - npm ci --force - npm update @apify/openapi - npm run build - env: - APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} + - name: Build docs + run: | + npm ci --force + npm update @apify/openapi + npm run build + env: + APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_PROJECT_KEY }} - - name: Run Lychee Link Checker - id: lychee - uses: lycheeverse/lychee-action@v1.10.0 - env: - GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - with: - fail: false - args: > - --base https://docs.apify.com - --exclude-path 'build/versions.html' - --max-retries 6 - --verbose - --no-progress - --accept '100..=103,200..=299,403..=403,429' - --output ./lychee/out.md - --format markdown - './build/**/*.html' - continue-on-error: true + - name: Run Lychee Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1.10.0 + env: + GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + with: + fail: false + args: > + --base https://docs.apify.com + --exclude-path 'build/versions.html' + --max-retries 6 + --verbose + --no-progress + --accept '100..=103,200..=299,403..=403,429' + --output ./lychee/out.md + --format markdown + './build/**/*.html' + continue-on-error: true - - name: Add job summary - if: always() - run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY + - name: Add job summary + if: always() + run: cat ./lychee/out.md >> $GITHUB_STEP_SUMMARY