GithubHelp home page GithubHelp logo

ruzickap / action-my-markdown-linter Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 139 KB

Style checking and linting for Markdown files

License: Apache License 2.0

Dockerfile 32.99% Shell 67.01%
markdown linter lint github-actions actions github-action linters linting

action-my-markdown-linter's Introduction

GitHub Actions: My Markdown Linter โœ”

GitHub Marketplace license release GitHub release date GitHub Actions status Docker Hub Build Status

This is a GitHub Action to lint Markdown files. It's using the markdownlint-cli and fd.

See the basic GitHub Action example:

name: markdown_lint
on:
  push:

jobs:
  markdown_lint:
    name: Check Markdown files
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Markdown Lint
        uses: ruzickap/action-my-markdown-linter@v1

Parameters

Variables used by action-my-markdown-linter GitHub Action:

Variable Default Description
config_file .markdownlint.yaml / .markdownlint.yml (if exists) Config file used by markdownlint-cli
debug (not defined) Enable debug mode for the entrypoint.sh script (set -x)
exclude (not defined) Exclude files or directories - see the --exclude parameter of fd command
fd_cmd_params . -0 --extension md --type f --hidden --no-ignore Set your own parameters for fd command. exclude and search_paths parameters are ignored if this is set.
search_paths (not defined) By default all *.md are checked in whole repository, but you can specify directories

Non of the parameters above are "mandatory".

Full example

GitHub Action example:

name: markdown_lint

on:
  push:
    branches:
      - main

jobs:
  markdown_lint:
  name: Check Markdown files
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Markdown Lint
        uses: ruzickap/action-my-markdown-linter@v1
        with:
          config_file: my_markdownlint.yml
          debug: true
          exclude: |
            my_exclude_dir/md_files/
            my_exclude_dir_2/markdown_files/
            CHANGELOG.md
          search_paths: |
            check_dir_1/md_files/
            check_dir_2/markdown_files/

      - name: Markdown Lint - check only 'docs' directory and exclude CHANGELOG.md
        uses: ruzickap/action-my-markdown-linter@v1
        with:
          search_paths: |
            docs/
          exclude: |
            CHANGELOG.md

      - name: Markdown Lint - simple example
        uses: ruzickap/action-my-markdown-linter@v1

      - name: Markdown Lint using pre-built container
        uses: docker://peru/my-markdown-linter@v1

Running locally

It's possible to use the Markdown linter task locally using docker:

docker run --rm -t -v "${PWD}/tests/test2:/mnt" peru/my-markdown-linter

Output:

*** Start checking...
*** Running: fd . -0 --extension md --type f --hidden --no-ignore
*** Running: markdownlint  normal.md
*** Checks completed...

Or you can also use parameters:

export INPUT_EXCLUDE="CHANGELOG.md test1/excluded_file.md bad.md excluded_dir/"
export INPUT_SEARCH_PATHS="tests/"
docker run --rm -t -e INPUT_EXCLUDE -e INPUT_SEARCH_PATHS -v "${PWD}:/mnt" peru/my-markdown-linter

Output:

*** Start checking...
*** Running: fd . -0 --extension md --type f --hidden --no-ignore --exclude CHANGELOG.md --exclude test1/excluded_file.md --exclude bad.md --exclude excluded_dir/ tests/
*** Running: markdownlint  tests/test2/normal.md
*** Checks completed...

Demo:

My Markdown Linter

Examples

Real examples of My Markdown Linter usage:

action-my-markdown-linter's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar lirantal avatar my-renovate[bot] avatar phspagiari avatar renovate-bot avatar ruzickap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

action-my-markdown-linter's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json5
Error type: The renovate configuration file contains some invalid settings
Message: Invalid packageRules[2].schedule: 'Invalid schedule: "0 0,2,4 1-7 * 0" has cron syntax, but doesn't have * as minutes'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.