mirror of
https://github.com/element-hq/ems-docs.git
synced 2026-01-11 19:46:31 +00:00
Added linter/rules/GH Actions
This commit is contained in:
parent
7c6ffdd653
commit
1f7daf5b5b
6 changed files with 419 additions and 0 deletions
24
.github/workflows/md-lint.yml
vendored
Normal file
24
.github/workflows/md-lint.yml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: Markdown Linting
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
run-as-action:
|
||||
name: Run Markdown Linting
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check all Markdown files except SUMMARY.md
|
||||
uses: ./
|
||||
with:
|
||||
args: '**/*.md'
|
||||
ignore: './src/SUMMARY.md'
|
||||
config: './lint/config/default.yml'
|
||||
|
||||
- name: Check SUMMARY.md
|
||||
uses: ./
|
||||
with:
|
||||
args: './src/SUMMARY.md'
|
||||
config: './lint/config/summary.yml'
|
||||
50
Dockerfile
Normal file
50
Dockerfile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
FROM node:12-alpine as builder
|
||||
|
||||
ARG MARKDOWN_CLI_VERSION="0.26.0"
|
||||
|
||||
# install packages
|
||||
RUN set -x \
|
||||
# `markdownlint-cli` sources: <https://github.com/igorshubovych/markdownlint-cli>
|
||||
&& npm install -g --production "markdownlint-cli@${MARKDOWN_CLI_VERSION}" \
|
||||
# `ncc` sources: <https://github.com/vercel/ncc>
|
||||
&& npm install -g --production "@vercel/ncc@0.24.1"
|
||||
|
||||
# prepare "file system structure" for runtime
|
||||
RUN set -x \
|
||||
&& mkdir -p /tmp/rootfs/usr/local/bin
|
||||
|
||||
# pack `markdownlint-cli` into single file and put into required location
|
||||
RUN set -x \
|
||||
&& ncc build /usr/local/lib/node_modules/markdownlint-cli --minify --no-cache --out /tmp/markdownlint-cli-packed \
|
||||
&& mv /tmp/markdownlint-cli-packed/index.js /tmp/rootfs/usr/local/bin/markdownlint
|
||||
|
||||
# copy additional image files
|
||||
COPY ./docker-entrypoint.sh /tmp/rootfs/docker-entrypoint.sh
|
||||
COPY ./lint /tmp/rootfs/lint
|
||||
|
||||
# Image hub: <https://hub.docker.com/r/mhart/alpine-node>, sources: <https://github.com/mhart/alpine-node>
|
||||
FROM mhart/alpine-node:slim-12 as runtime
|
||||
|
||||
LABEL \
|
||||
# Docs: <https://github.com/opencontainers/image-spec/blob/master/annotations.md>
|
||||
org.opencontainers.image.title="Markdown linter" \
|
||||
org.opencontainers.image.description="Markdown linter with rules and settings presetts" \
|
||||
org.opencontainers.image.url="https://github.com/avto-dev/markdown-lint" \
|
||||
org.opencontainers.image.source="https://github.com/avto-dev/markdown-lint" \
|
||||
org.opencontainers.image.vendor="avto-dev" \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
|
||||
# copy all files from builder as a single layer
|
||||
COPY --from=builder /tmp/rootfs /
|
||||
|
||||
RUN set -x \
|
||||
# create node user and group
|
||||
&& addgroup -g 1000 node \
|
||||
&& adduser -u 1000 -G node -s /bin/sh -D node \
|
||||
# setup files owner
|
||||
&& chown -R node:node /lint \
|
||||
# install required for image dependencies
|
||||
&& apk add --no-cache bash \
|
||||
&& /usr/local/bin/markdownlint --version
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
34
action.yml
Normal file
34
action.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: Markdown Linting Action
|
||||
description: GitHub Action to run markdown linter
|
||||
author: avto-dev
|
||||
|
||||
inputs: # <https://git.io/JvkYF#inputs>
|
||||
rules:
|
||||
description: 'Custom rule files (file|directory|glob|package)'
|
||||
required: false
|
||||
config:
|
||||
description: 'Configuration file (JSON, JSONC, or YAML)'
|
||||
required: false
|
||||
fix:
|
||||
description: 'Fix basic errors'
|
||||
required: false
|
||||
default: 'false'
|
||||
output:
|
||||
description: 'Write issues to file'
|
||||
required: false
|
||||
ignore:
|
||||
description: 'Files to ignore/exclude'
|
||||
required: false
|
||||
args: # do not change this name! reason: <https://git.io/Jvk8K> (usage as named action and docker image with same syntax)
|
||||
description: 'Files (directories|globs) for a work or any additional arguments'
|
||||
required: true
|
||||
|
||||
runs: # <https://git.io/JvkYF#runs>
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ${{ inputs.args }}
|
||||
|
||||
branding: # <https://git.io/JvkYF#branding>
|
||||
icon: file-text
|
||||
color: green
|
||||
35
docker-entrypoint.sh
Executable file
35
docker-entrypoint.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
shopt -s globstar
|
||||
|
||||
RUN_ARGS="";
|
||||
|
||||
if [ "$INPUT_RULES" != "" ]; then
|
||||
RUN_ARGS="$RUN_ARGS --rules $INPUT_RULES";
|
||||
fi;
|
||||
|
||||
if [ "$INPUT_CONFIG" != "" ]; then
|
||||
RUN_ARGS="$RUN_ARGS --config $INPUT_CONFIG";
|
||||
fi;
|
||||
|
||||
if [ "$INPUT_FIX" = "true" ]; then
|
||||
RUN_ARGS="$RUN_ARGS --fix";
|
||||
fi;
|
||||
|
||||
if [ "$INPUT_OUTPUT" != "" ]; then
|
||||
RUN_ARGS="$RUN_ARGS --output $INPUT_OUTPUT";
|
||||
fi;
|
||||
|
||||
if [ "$INPUT_IGNORE" != "" ]; then
|
||||
for ignore in $INPUT_IGNORE; do
|
||||
RUN_ARGS="$RUN_ARGS --ignore $ignore";
|
||||
done
|
||||
fi;
|
||||
|
||||
if [ "$DEBUG" = "true" ]; then
|
||||
printenv | sort;
|
||||
echo "$RUN_ARGS";
|
||||
fi;
|
||||
|
||||
# Do not quote "$@" as Github Actions passes each argument as a single arg.
|
||||
# So 'args: --fix foo bar.md' would be treated as a single string and not be parsed by markdownlint
|
||||
exec /usr/local/bin/markdownlint $RUN_ARGS $@
|
||||
138
lint/config/default.yml
Normal file
138
lint/config/default.yml
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
default: false # includes/excludes all rules by default
|
||||
|
||||
# Heading levels should only increment by one level at a time <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md001>
|
||||
MD001: true
|
||||
|
||||
# Heading style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md003>
|
||||
MD003:
|
||||
style: 'atx'
|
||||
|
||||
# Unordered list style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md004>
|
||||
MD004:
|
||||
style: 'dash'
|
||||
|
||||
# Inconsistent indentation for list items at the same level <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md005>
|
||||
MD005: true
|
||||
|
||||
# Consider starting bulleted lists at the beginning of the line <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md006>
|
||||
MD006: true
|
||||
|
||||
# Unordered list indentation <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md007>
|
||||
MD007: true
|
||||
|
||||
# Trailing spaces <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009>
|
||||
MD009: true
|
||||
|
||||
# Hard tabs <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md010>
|
||||
MD010: true
|
||||
|
||||
# Reversed link syntax <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md011>
|
||||
MD011: true
|
||||
|
||||
# Multiple consecutive blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md012>
|
||||
MD012: true
|
||||
|
||||
# Line length <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013>
|
||||
MD013: false
|
||||
|
||||
# Dollar signs used before commands without showing output <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md014>
|
||||
MD014: false
|
||||
|
||||
# No space after hash on atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018>
|
||||
MD018: true
|
||||
|
||||
# Multiple spaces after hash on atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md019>
|
||||
MD019: true
|
||||
|
||||
# No space inside hashes on closed atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md020>
|
||||
MD020: true
|
||||
|
||||
# Multiple spaces inside hashes on closed atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md021>
|
||||
MD021: true
|
||||
|
||||
# Headings should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022>
|
||||
MD022: true
|
||||
|
||||
# Headings must start at the beginning of the line <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md023>
|
||||
MD023: true
|
||||
|
||||
# Multiple headings with the same content <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md024>
|
||||
MD024:
|
||||
allow_different_nesting: true
|
||||
|
||||
# Multiple top level headings in the same document <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025>
|
||||
MD025: true
|
||||
|
||||
# Trailing punctuation in heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md026>
|
||||
MD026: true
|
||||
|
||||
# Multiple spaces after blockquote symbol <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md027>
|
||||
MD027: true
|
||||
|
||||
# Blank line inside blockquote <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md028>
|
||||
MD028: false
|
||||
|
||||
# Ordered list item prefix <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md029>
|
||||
MD029:
|
||||
style: 'one'
|
||||
|
||||
# Spaces after list markers <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md030>
|
||||
MD030: true
|
||||
|
||||
# Fenced code blocks should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031>
|
||||
MD031: true
|
||||
|
||||
# Lists should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md032>
|
||||
MD032: true
|
||||
|
||||
# Inline HTML <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md033>
|
||||
MD033:
|
||||
allowed_elements: ['i', 'br']
|
||||
|
||||
# Bare URL used <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md034>
|
||||
MD034: true
|
||||
|
||||
# Horizontal rule style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md035>
|
||||
MD035:
|
||||
style: '---'
|
||||
|
||||
# Emphasis used instead of a heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md036>
|
||||
MD036: false
|
||||
|
||||
# Spaces inside emphasis markers <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md037>
|
||||
MD037: true
|
||||
|
||||
# Spaces inside code span elements <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md038>
|
||||
MD038: true
|
||||
|
||||
# Spaces inside link text <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md039>
|
||||
MD039: true
|
||||
|
||||
# Fenced code blocks should have a language specified <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040>
|
||||
MD040: true
|
||||
|
||||
# First line in file should be a top level heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md041>
|
||||
MD041: true
|
||||
|
||||
# No empty links <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md042>
|
||||
MD042: true
|
||||
|
||||
# Required heading structure <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md043>
|
||||
MD043: false
|
||||
|
||||
# Proper names should have the correct capitalization <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md044>
|
||||
MD044: false
|
||||
|
||||
# Images should have alternate text (alt text) <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md045>
|
||||
MD045: false
|
||||
|
||||
# Code block style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md046>
|
||||
MD046:
|
||||
style: 'fenced'
|
||||
|
||||
# Files should end with a single newline character <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md047>
|
||||
MD047: true
|
||||
|
||||
# Code fence style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md048>
|
||||
MD048:
|
||||
style: 'backtick'
|
||||
138
lint/config/summary.yml
Normal file
138
lint/config/summary.yml
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
default: false # includes/excludes all rules by default
|
||||
|
||||
# Heading levels should only increment by one level at a time <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md001>
|
||||
MD001: true
|
||||
|
||||
# Heading style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md003>
|
||||
MD003:
|
||||
style: 'atx'
|
||||
|
||||
# Unordered list style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md004>
|
||||
MD004:
|
||||
style: 'dash'
|
||||
|
||||
# Inconsistent indentation for list items at the same level <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md005>
|
||||
MD005: true
|
||||
|
||||
# Consider starting bulleted lists at the beginning of the line <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md006>
|
||||
MD006: true
|
||||
|
||||
# Unordered list indentation <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md007>
|
||||
MD007: true
|
||||
|
||||
# Trailing spaces <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009>
|
||||
MD009: true
|
||||
|
||||
# Hard tabs <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md010>
|
||||
MD010: true
|
||||
|
||||
# Reversed link syntax <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md011>
|
||||
MD011: true
|
||||
|
||||
# Multiple consecutive blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md012>
|
||||
MD012: true
|
||||
|
||||
# Line length <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013>
|
||||
MD013: false
|
||||
|
||||
# Dollar signs used before commands without showing output <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md014>
|
||||
MD014: false
|
||||
|
||||
# No space after hash on atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018>
|
||||
MD018: true
|
||||
|
||||
# Multiple spaces after hash on atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md019>
|
||||
MD019: true
|
||||
|
||||
# No space inside hashes on closed atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md020>
|
||||
MD020: true
|
||||
|
||||
# Multiple spaces inside hashes on closed atx style heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md021>
|
||||
MD021: true
|
||||
|
||||
# Headings should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022>
|
||||
MD022: true
|
||||
|
||||
# Headings must start at the beginning of the line <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md023>
|
||||
MD023: true
|
||||
|
||||
# Multiple headings with the same content <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md024>
|
||||
MD024:
|
||||
allow_different_nesting: true
|
||||
|
||||
# Multiple top level headings in the same document <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025>
|
||||
MD025: true
|
||||
|
||||
# Trailing punctuation in heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md026>
|
||||
MD026: true
|
||||
|
||||
# Multiple spaces after blockquote symbol <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md027>
|
||||
MD027: true
|
||||
|
||||
# Blank line inside blockquote <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md028>
|
||||
MD028: false
|
||||
|
||||
# Ordered list item prefix <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md029>
|
||||
MD029:
|
||||
style: 'one'
|
||||
|
||||
# Spaces after list markers <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md030>
|
||||
MD030: true
|
||||
|
||||
# Fenced code blocks should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031>
|
||||
MD031: true
|
||||
|
||||
# Lists should be surrounded by blank lines <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md032>
|
||||
MD032: true
|
||||
|
||||
# Inline HTML <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md033>
|
||||
MD033:
|
||||
allowed_elements: ['i', 'br']
|
||||
|
||||
# Bare URL used <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md034>
|
||||
MD034: true
|
||||
|
||||
# Horizontal rule style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md035>
|
||||
MD035:
|
||||
style: '---'
|
||||
|
||||
# Emphasis used instead of a heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md036>
|
||||
MD036: false
|
||||
|
||||
# Spaces inside emphasis markers <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md037>
|
||||
MD037: true
|
||||
|
||||
# Spaces inside code span elements <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md038>
|
||||
MD038: true
|
||||
|
||||
# Spaces inside link text <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md039>
|
||||
MD039: true
|
||||
|
||||
# Fenced code blocks should have a language specified <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040>
|
||||
MD040: true
|
||||
|
||||
# First line in file should be a top level heading <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md041>
|
||||
MD041: false
|
||||
|
||||
# No empty links <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md042>
|
||||
MD042: true
|
||||
|
||||
# Required heading structure <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md043>
|
||||
MD043: false
|
||||
|
||||
# Proper names should have the correct capitalization <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md044>
|
||||
MD044: false
|
||||
|
||||
# Images should have alternate text (alt text) <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md045>
|
||||
MD045: false
|
||||
|
||||
# Code block style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md046>
|
||||
MD046:
|
||||
style: 'fenced'
|
||||
|
||||
# Files should end with a single newline character <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md047>
|
||||
MD047: true
|
||||
|
||||
# Code fence style <https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md048>
|
||||
MD048:
|
||||
style: 'backtick'
|
||||
Loading…
Add table
Reference in a new issue