This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f7dfcc8
Showing
7 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "markdownlint", | ||
"pattern": [ | ||
{ | ||
"regexp": "^([^:]*):(\\d+):?(\\d+)?\\s([\\w-\\/]*)\\s(.*)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"code": 4, | ||
"message": 5 | ||
} | ||
] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: shellcheck entrypoint.sh | ||
- uses: ./ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"default": true, | ||
"MD003": { | ||
"style": "atx" | ||
}, | ||
"MD004": { | ||
"style": "asterisk" | ||
}, | ||
"MD013": { | ||
"code_blocks": false, | ||
"tables": false | ||
}, | ||
"MD033": { | ||
"allowed_elements": [ | ||
"details", | ||
"summary" | ||
] | ||
}, | ||
"MD046": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:lts-alpine | ||
|
||
COPY entrypoint.sh .github/problem-matcher.json .markdownlint.json / | ||
|
||
RUN npm install --global --production markdownlint-cli | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# markdownlint action | ||
|
||
This action lints your Markdown files with [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli). | ||
|
||
## Usage | ||
|
||
Including the action without any defaults will find a local markdownlint config | ||
file (`.markdownlint.{yaml,yml,json}`) or use our included default and scan all | ||
files with the `md` or `markdown` extension. | ||
|
||
```yaml | ||
- uses: articulate/actions-markdownlint@main | ||
``` | ||
You can set the config file, the files it scans, or files/directories to ignore. | ||
```yaml | ||
- uses: articulate/actions-markdownlint@main | ||
with: | ||
config: markdownlint-config.json | ||
files: 'docs/**/*.md' | ||
ignore: node_modules | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'markdownlint' | ||
author: 'Articulate' | ||
description: 'Lint your markdown' | ||
inputs: | ||
config: | ||
description: 'markdownlint config file' | ||
required: false | ||
files: | ||
description: 'Markdown files to scan' | ||
required: false | ||
default: '**/*.{md,markdown}' | ||
ignore: | ||
description: 'Files or directories to ignore' | ||
required: false | ||
fix: | ||
description: 'Try to fix basic errors' | ||
required: false | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
branding: | ||
color: 'blue' | ||
icon: 'check-circle' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
# Copy the matcher to a shared volume with the host; otherwise "add-matcher" | ||
# can't find it. | ||
cp /problem-matcher.json "${HOME}/markdownlint-problem-matcher.json" | ||
echo "::add-matcher::${HOME}/markdownlint-problem-matcher.json" | ||
|
||
MARKDOWNLINT= | ||
|
||
if [ -z "$INPUT_CONFIG" ]; then | ||
echo "::debug::no config given, finding suitable config" | ||
INPUT_CONFIG=/.markdownlint.json | ||
for cfg in .markdownlint.yaml .markdownlint.yml .markdownlint.json .markdown-lint.yml .markdown-lint.json; do | ||
if [ -f "$cfg" ]; then | ||
INPUT_CONFIG="$cfg" | ||
continue | ||
fi | ||
done | ||
fi | ||
|
||
echo "::debug::using config ${INPUT_CONFIG}" | ||
MARKDOWNLINT="${MARKDOWNLINT} --config ${INPUT_CONFIG}" | ||
|
||
if [ -n "$INPUT_IGNORE" ]; then | ||
echo "::debug::ignoring ${INPUT_IGNORE}" | ||
MARKDOWNLINT="${MARKDOWNLINT} --ignore ${INPUT_IGNORE}" | ||
fi | ||
|
||
if [ -n "$INPUT_FIX" ]; then | ||
echo "::debug::attempting to fix input" | ||
MARKDOWNLINT="${MARKDOWNLINT} --fix" | ||
fi | ||
|
||
echo "::debug::linting ${INPUT_FILES}" | ||
# shellcheck disable=SC2086 | ||
markdownlint ${MARKDOWNLINT} ${INPUT_FILES} |