Skip to content

rickstaa/action-remark-lint

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Action-remark-lint GitHub Action

Test release GitHub release (latest SemVer) action-bumpr supported

This action runs the remark-lint linter to check/format your markdown code on a push or pull request.

Quickstart

name: remark-lint-action
on: [push, pull_request]
jobs:
  remark-lint:
    name: runner / remark-lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: remark-lint
        uses: rickstaa/action-remark-lint@v1

Inputs

remark_args

optional: Remark-lint input arguments. Defaults to . --frail --quiet.

fail_on_error

optional: Exit code when remark-lint linting errors are found [true, false]. Defaults to 'true'.

Outputs

is_formatted

Boolean specifying whether any files were formatted using the remark-lint linter.

Advanced use cases

Annotate changes

This action can be combined with reviewdog/action-suggester also to annotate any possible changes (uses git diff).

name: remark-lint-action
on: [push, pull_request]
jobs:
  name: runner / remark-lint
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v2
    - name: Check files using the remark-lint linter
      uses: rickstaa/action-remark-lint@v1
      id: action_remark_lint
      with:
        remark_args: ". -o"
    - name: Annotate diff changes using reviewdog
      if: steps.action_remark_lint.outputs.is_formatted == 'true'
      uses: reviewdog/action-suggester@v1
      with:
        tool_name: remarkfmt

Commit changes or create a pull request

This action can be combined with peter-evans/create-pull-request to also apply the annotated changes to the repository.

name: remark-lint-action
on: [push, pull_request]
jobs:
  name: runner / remark-lint
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v2
    - name: Check files using remark-lint linter
      uses: rickstaa/action-remark-lint@v1
      id: action_remark_lint
      with:
        remark_args: ". -o"
    - name: Create Pull Request
      if: steps.action_remark_lint.outputs.is_formatted == 'true'
      uses: peter-evans/create-pull-request@v3
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        title: "Format Python code with remark-lint linter"
        commit-message: ":art: Format Python code with remark-lint"
        body: |
          There appear to be some python formatting errors in ${{ github.sha }}. This pull request
          uses the [remark-lint](https://github.com/remarkjs/remark-lint) linter to fix these issues.
        base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch
        branch: actions/remark-lint