Check markdown files

This commit is contained in:
Gaurav Nelson 2019-04-03 15:16:17 +10:00
parent 1aa0c7e0f9
commit d1622fc5ce
4 changed files with 57 additions and 2 deletions

8
.github/main.workflow vendored Normal file
View File

@ -0,0 +1,8 @@
workflow "New workflow" {
on = "push"
resolves = ["markdown-link-check"]
}
action "markdown-link-check" {
uses = "./"
}

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM alpine:3.8
RUN apk add --no-cache bash nodejs npm
LABEL "com.github.actions.name"="markdown-link-check"
LABEL "com.github.actions.description"="Check if all links are valid in markdown files."
LABEL "com.github.actions.icon"="link"
LABEL "com.github.actions.color"="green"
LABEL "repository"="https://github.com/gaurav-nelson/github-action-markdown-link-check.git"
LABEL "homepage"="https://github.com/gaurav-nelson/github-action-markdown-link-check"
LABEL "maintainer"="Gaurav Nelson"
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,2 +1,20 @@
# github-action-markdown-link-check
Check all links in markdown files if they are alive or dead.
# GitHub Action - Markdown link check 🔗✔️
This GitHub action checks all Markdown files in your repository for broken links. (Uses [tcort/markdown-link-check](https://github.com/tcort/markdown-link-check))
## Sample workflow
```
workflow "New workflow" {
on = "push"
resolves = ["markdown-link-check"]
}
action "markdown-link-check" {
uses = "./"
}
```
## Test links
www.google.com
[This is a broken link](www.exampleexample.cox)

17
entrypoint.sh Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eu
npm i -g markdown-link-check
echo "=========================> MARKDOWN LINK CHECK <========================="
find . -name \*.md -not -path "./node_modules/*" -exec markdown-link-check {} \; 2> error.txt
echo "========================================================================="
if [ -e error.txt ] ; then
if grep -q "ERROR:" error.txt; then
exit 113
fi
fi