Skip to content

Commit

Permalink
Check markdown files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson committed Apr 3, 2019
1 parent 1aa0c7e commit d1622fc
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
workflow "New workflow" {
on = "push"
resolves = ["markdown-link-check"]
}

action "markdown-link-check" {
uses = "./"
}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d1622fc

Please sign in to comment.