Check markdown links #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check markdown links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 * *' # Every month | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
- '.lycheeignore' | |
- '.github/workflows/linkcheck.yml' | |
env: | |
DIR: 'docs' | |
jobs: | |
linkcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Julia | |
uses: julia-actions/setup-julia@v1 | |
- name: Convert literate notebooks to markdown files | |
shell: julia --color=yes {0} | |
working-directory: ${{ env.DIR }} | |
run: | | |
import Pkg | |
Pkg.add("Literate") | |
using Literate | |
for (root, dirs, files) in walkdir(pwd()) | |
for file in files | |
if endswith(file, ".jl") | |
Literate.markdown(joinpath(root, file); mdstrings=true, flavor = Literate.CommonMarkFlavor()) | |
end | |
end | |
end | |
- name: Restore lychee cache | |
id: restore-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: .lycheecache | |
key: cache-lychee-${{ github.sha }} | |
restore-keys: cache-lychee- | |
- name: Lychee Checker | |
uses: lycheeverse/[email protected] | |
id: lychee | |
with: | |
fail: true | |
args: '--accept 200,204,429 --verbose --no-progress --cache --max-cache-age 1d ${{ env.DIR }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save lychee cache | |
uses: actions/cache/save@v3 | |
if: always() | |
with: | |
path: .lycheecache | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} |