Merge pull request #5 from cooklang/add-markdown-link-check

Add markdown link check.
This commit is contained in:
nιcнolaѕ wιlde 2022-06-01 07:09:07 -07:00 committed by GitHub
commit 2450f39656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 0 deletions

24
.github/workflows/link-check.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: link-check
on: # yamllint disable-line rule:truthy
# Schedule check each day at 8 UTC
schedule: [{cron: "0 8 * * *"}]
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
markdown-link-check:
name: Markdown link check
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Check markdown links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
file-path: './README.md'
config-file: './mlc_config.json'

View File

@ -1,6 +1,8 @@
<!--lint disable awesome-git-repo-age-->
# Awesome Cooklang Recipes [![Awesome](https://awesome.re/badge-flat.svg)](https://awesome.re)
[![link-check](https://img.shields.io/github/workflow/status/cooklang/awesome-cooklang-recipes/link-check?label=link-check&logo=github&style=for-the-badge)](https://github.com/cooklang/awesome-cooklang-recipes/actions/workflows/link-check.yaml)
<img src="https://cooklang.org/images/logo.svg" align="left" width="144px" height="144px"/>
> [cooklang][1] is a recipe markup language used to simplify your personal recipe management, streamline your shopping

View File

@ -20,6 +20,10 @@ tasks:
cmds:
- task: awesome-lint
- task: yamllint
linkcheck:
desc: Check for dead links
cmds:
- ./scripts/linkcheck.sh
render:
desc: Render README.md
cmds:

3
mlc_config.json Normal file
View File

@ -0,0 +1,3 @@
{
"aliveStatusCodes": [200, 206, 403, 429]
}

8
scripts/linkcheck.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
set -o pipefail
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )
readonly DIR
for f in $(find "${DIR}" -name \*.md); do
docker run --rm -v /:/tmp:ro -i -w /tmp ghcr.io/tcort/markdown-link-check:stable "/tmp${f}" -c "/tmp${DIR}/mlc_config.json" || exit 1
done