DEV Community

Cover image for Disable Annotations in Github Actions
Sibiraj
Sibiraj

Posted on

4

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 👋

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay