redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

lint command report in github action annotations/pr

Open kekel87 opened this issue 10 months ago • 3 comments

Hello,

We have a Github Action that controls our api documentation via redocly lint command. I'd like to put warnings and errors in the annotations of the Github Action, so that they can be displayed directly from our pull requests. I can't find any clear documentation on this...

On another repo, we use eslint and we have nothing to do, the errors/warining show up by themselves (it looks like stylish).

I've tried every possible --format of the lint command, but nothing works. I can't figure out how to output the report as a file and try to do something with another action dedicated to a specific format.

Describe the solution you'd like

I'd like errors/warning to show up on their own in the annotations when I run the lint command.

Describe alternatives you've considered

Export the result to a file. And process it with another Github action.

Additional context

Lint command:

npm run lint
npm run lint -- --format stylish

Npm scripts:

"scripts": {
    "lint": "redocly lint my-file.yaml",
  }

Eslint github action output: image Eslint github annotation: image

Redocly lint github action output (stylish format): image

kekel87 avatar Oct 19 '23 07:10 kekel87

I assume your request is a duplicate of this one: https://github.com/Redocly/redocly-cli/issues/976 Feel free to reopen if you think it's different.

tatomyr avatar Oct 19 '23 08:10 tatomyr

Not really. I found this issue. But for me, it's in the annotations, not the summary.

kekel87 avatar Oct 19 '23 08:10 kekel87

I can't reopen it :upside_down_face:

kekel87 avatar Oct 19 '23 08:10 kekel87

I'm pleased to let you know that this feature was introduced in #1497 and is available in Redocly CLI from version 1.11.0 onwards.

How to use it: where you have redocly lint my-file.yaml, add a --format=github-actions to the lint command and you should see annotations for any warnings or errors in that file.

I'll close the issue (otherwise we'll forget about it), but comments and feedback are welcome!

lornajane avatar Apr 18 '24 15:04 lornajane