name: check links

on:
  push:
    branches:
      - main
  pull_request:
  workflow_dispatch:

jobs:
  checklinks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Restore lychee cache
        uses: actions/cache@v3
        with:
          path: .lycheecache
          key: cache-lychee-${{ github.sha }}
          restore-keys: cache-lychee-

      - name: Check links
        uses: lycheeverse/lychee-action@v1
        with:
          args: "--cache --max-cache-age 1d ."
          fail: true
