From fdd640574ee07abeeda9c6ef7360f55c1e0f54de Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 18 Sep 2024 10:42:42 +0200 Subject: [PATCH] include lychee to check for broken links --- .github/workflows/hugo.yaml | 36 +++++++++++++++++++++++++++++++++++- .gitignore | 3 +++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml index da9b0d7..a531949 100644 --- a/.github/workflows/hugo.yaml +++ b/.github/workflows/hugo.yaml @@ -42,9 +42,32 @@ jobs: run: hugo - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-artifact@v4 with: + name: public path: ./public + include-hidden-files: true + retention-days: 1 + + # Checking links using lychee + linkchecker: + runs-on: ubuntu-22.04 + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: public + path: . + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + with: + args: '-r 5 -u "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Apple WebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" --exclude sncf.com --exclude nge.flatland.cloud --max-concurrency 1 .' + # Fail on errors + fail: false + # TODO: Implement https://github.com/lycheeverse/lychee/issues/989 once it's done. Will help with LinkedIn rate limits # Deployment job deploy: @@ -56,6 +79,17 @@ jobs: # Only deploy if on main branch if: github.ref == 'refs/heads/main' steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: public + path: ./public + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./public + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 diff --git a/.gitignore b/.gitignore index 29db922..44b6f72 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,7 @@ hugo.linux # Temporary lock file while building /.hugo_build.lock +# lychee +.lycheecache + # End of https://www.toptal.com/developers/gitignore/api/hugo