Skip to content

check-links: add pipeline to check all links (#130) #26

check-links: add pipeline to check all links (#130)

check-links: add pipeline to check all links (#130) #26

Workflow file for this run

name: Check links with Lychee
on:
workflow_dispatch:
push:
branches: [main]
jobs:
check-links:
runs-on: ubuntu-latest
steps:
- name: Restore lychee cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: true
- run: |
echo $(grep -rh "More information: " tldr/pages | sort -u) > links.txt
- name: Lychee URL checker
uses: lycheeverse/lychee-action@v1
id: lychee
with:
args: >-
--cache
--verbose
--no-progress
--accept 100..=103,200..=299,429
--max-concurrency 25
--exclude-all-private
links.txt
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Find the last report issue open
uses: micalevisk/last-issue-action@v2
id: last-issue
with:
state: open
labels: check links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update last report open issue created
uses: peter-evans/create-issue-from-file@v4
with:
title: Link checker report
content-filepath: lychee/out.md
issue-number: ${{ steps.last-issue.outputs.issue-number }}
labels: check links
- name: Close last report open issue
if: ${{ steps.lychee.outputs.exit_code == 0 }}
uses: peter-evans/close-issue@v2
with:
issue-number: ${{ steps.last-issue.outputs.issue-number }}
- name: Save lychee cache
uses: actions/cache/save@v4
if: always()
with:
path: .lycheecache
key: ${{ steps.restore-cache.outputs.cache-primary-key }}