Disable Github Actions check runs from annotating files

3.7k Views Asked by At

Looking for a way to disable Github Actions check runs from annotating files.

/* Context - Working on an eslint workflow action to comment on PR's, as it's annoying with this check runs annotating all files by default */

Ref PR- https://github.com/tamdilip/ember_poc/pull/143/files

2

There are 2 best solutions below

0
On BEST ANSWER

Observed that CLI error logs in terminal console are automatically invoking check-runs which is the reason for annotation as this seems to be a feature of Github Action itself by default and no way to disable it by any configuration.

For time being I managed to stop the annotations by capturing those CLI logs output as XML format separately via a listener instead of directly letting the error to log in terminal console.

Still a configuration level option to toggle check-runs from annotating should be made available.

0
On

Annotations are added when problem matchers finds a match in the logs.

For example. setup-node registers eslint problem matchers. which can be removed by

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
  with:
    node-version: '12'
- run: |
       echo "::remove-matcher owner=eslint-compact::"
       echo "::remove-matcher owner=eslint-stylish::"

You can also you the eslint action I wrote, that runs linter on changed files. https://github.com/sibiraj-s/action-eslint. You can disable annotations by passing input args annotations: false

name: Lint

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  eslint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '14'
      - run: npm ci # or yarn install
      - uses: sibiraj-s/action-eslint@v1
        with:
          extensions: 'js, jsx, ts, tsx'
          annotations: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Read more about problem matchers here

https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers

Medium article for disabling annotations in other actions as well. https://sibiraj-s.medium.com/disable-annotations-in-github-actions-ff938d5ea4f3