aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/check-links.yml
blob: 27cf50c7aa99aaf211e2be0198a26674936e225a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 🌐 Check Links

"on":
  pull_request:
    branches: [main]
    paths:
      - "**.md"
      - .github/workflows/check-links.yaml
      - flake.lock
  push:
    branches: [main]
    paths:
      - "**.md"
      - .github/workflows/check-links.yaml
      - flake.lock
  schedule:
    # Run once a month on the 28th.
    - cron: "0 0 28 * *"
  workflow_dispatch:

jobs:
  lychee:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - uses: actions/checkout@v4
      - uses: DeterminateSystems/nix-installer-action@v16
      - name: Build the site
        run: nix build --print-build-logs
      - name: Restore lychee cache
        uses: actions/cache/restore@v4
        with:
          path: .lycheecache
          key: lychee-cache
      - name: Check links
        id: lychee
        uses: lycheeverse/lychee-action@v2
        with:
          fail: false
          args: "./result/**/*.html"
      - name: Save lychee cache
        uses: actions/cache/save@v4
        if: always()
        with:
          key: lychee-cache
          path: .lycheecache
      - name: Create issue
        if: steps.lychee.outputs.exit_code != 0
        uses: peter-evans/create-issue-from-file@v5
        with:
          title: "[lychee] Broken links"
          content-filepath: ./lychee/out.md
          labels: bug, automated issue