|
1 | | -# action-markdownlint |
| 1 | +# GitHub Action: Run markdownlint with reviewdog |
| 2 | + |
| 3 | +Based on [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck) |
| 4 | + |
| 5 | +[](https://github.com/prologic/action-markdownlint/actions) |
| 6 | +[](https://github.com/prologic/action-markdownlint/releases) |
| 7 | + |
| 8 | +This action runs [markdownlint](https://github.com/DavidAnson/markdownlint) with |
| 9 | +[reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve |
| 10 | +code review experience. |
| 11 | + |
| 12 | +## Inputs |
| 13 | + |
| 14 | +<!-- markdownlint-disable MD013 --> |
| 15 | +```yml |
| 16 | +inputs: |
| 17 | + github_token: |
| 18 | + description: 'GITHUB_TOKEN.' |
| 19 | + default: '${{ github.token }}' |
| 20 | + ### Flags for reviewdog ### |
| 21 | + level: |
| 22 | + description: 'Report level for reviewdog [info,warning,error]' |
| 23 | + default: 'error' |
| 24 | + reporter: |
| 25 | + description: 'Reporter of reviewdog command [github-check,github-pr-review].' |
| 26 | + default: 'github-check' |
| 27 | + filter_mode: |
| 28 | + description: | |
| 29 | + Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. |
| 30 | + Default is added. |
| 31 | + default: 'added' |
| 32 | + fail_level: |
| 33 | + description: | |
| 34 | + If set to `none`, always use exit code 0 for reviewdog. |
| 35 | + Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. |
| 36 | + Possible values: [none,any,info,warning,error] |
| 37 | + Default is `none`. |
| 38 | + default: 'none' |
| 39 | + fail_on_error: |
| 40 | + description: | |
| 41 | + Deprecated, use `fail_level` instead. |
| 42 | + Exit code for reviewdog when errors are found [true,false] |
| 43 | + Default is `false`. |
| 44 | + deprecationMessage: Deprecated, use `fail_level` instead. |
| 45 | + default: 'false' |
| 46 | + reviewdog_flags: |
| 47 | + description: 'Additional reviewdog flags' |
| 48 | + default: '' |
| 49 | + ### Flags for markdownlint-cli ### |
| 50 | + markdownlint_flags: |
| 51 | + description: "Options of markdownlint-cli command. Default: '.'" |
| 52 | + default: '.' |
| 53 | +``` |
| 54 | +<!-- markdownlint-enable MD013 --> |
| 55 | +
|
| 56 | +## Example usage |
| 57 | +
|
| 58 | +### [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) |
| 59 | +
|
| 60 | +```yml |
| 61 | +name: reviewdog |
| 62 | +on: [pull_request] |
| 63 | +jobs: |
| 64 | + markdownlint: |
| 65 | + name: runner / markdownlint |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 69 | + - name: markdownlint |
| 70 | + uses: step-security/action-markdownlint@3667398db9118d7e78f7a63d10e26ce454ba5f58 # v0.26.2 |
| 71 | + with: |
| 72 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + reporter: github-pr-review |
| 74 | +``` |
0 commit comments