DEV Community

Cover image for Disable Annotations in Github Actions
Sibiraj
Sibiraj

Posted on

Disable Annotations in Github Actions

Annotations are created when a problem matcher detects a match in the CI log. Problem matchers are enabled by default by some actions like

Eslint Annotation

You can disable the annotations by executing the remove-matcher command.

Eslint/Typescript (setup-node)

Add the following to your action after setup-node

For eslint



- run: |
    echo "::remove-matcher owner=eslint-compact::"
    echo "::remove-matcher owner=eslint-stylish::"


Enter fullscreen mode Exit fullscreen mode

For Typescript



- run: |
    echo "::remove-matcher owner=tsc::"


Enter fullscreen mode Exit fullscreen mode

That should do it.

You can read more about Adding/Removing problem matchers here. https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers

Related links:


Bonus

Action Eslint is a Github Action that runs on the changed files in a PR.



jobs:
  eslint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '18'
      - run: npm ci
      - uses: sibiraj-s/action-eslint@v1
        with:
          eslintArgs: '--ignore-path .gitignore --quiet'
          extensions: 'js, jsx, ts, tsx'
          annotations: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


Enter fullscreen mode Exit fullscreen mode

You can disable annotations by setting the input value to false.


Disable Annotations for Other Actions

Golang (setup-go)



- run: |
    echo "::remove-matcher owner=go::"


Enter fullscreen mode Exit fullscreen mode

Python (setup-python)



- run: |
    echo "::remove-matcher owner=python::"


Enter fullscreen mode Exit fullscreen mode

dotnet (setup-dotnet)



- run: |
    echo "::remove-matcher owner=csc::"


Enter fullscreen mode Exit fullscreen mode

java (setup-java)



- run: |
    echo "::remove-matcher owner=csc::"


Enter fullscreen mode Exit fullscreen mode

Hope that helps.

Good day 👋

Top comments (0)