Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Calculate check conclusion from annotations #1170

Conversation

carmanchris31
Copy link
Contributor

@carmanchris31 carmanchris31 commented Apr 28, 2022

This attempts to address reviewdog/action-eslint#62 by calculating the conclusion of a check run based on the level of the annotations.

That is to say:

  • if there are any error-level annotations the run is a failure
  • if there are any warning- or info-level annotations the run is neutral
  • otherwise, the run is a success

For reverse compatibility, the config Level takes precedence when provided.

  • Updated Unreleased section in CHANGELOG or it's not notable changes.
  • Added additional tests

@carmanchris31 carmanchris31 force-pushed the fix/calculate-conclusion-from-annotations branch from 206164f to 14435d7 Compare April 28, 2022 21:58
@simllll
Copy link

simllll commented May 3, 2022

Looking forward to this :-)

@simllll
Copy link

simllll commented May 11, 2022

@carmanchris31 is there a reason why it's still a draft?

@carmanchris31
Copy link
Contributor Author

@carmanchris31 is there a reason why it's still a draft?

I wanted to cover the new code with tests to make sure it works as intended. I haven’t gotten to it yet but will do so when I can (I’ll happily accept help to get this done sooner).

@Drowze
Copy link
Contributor

Drowze commented Jun 3, 2022

Looking forward to this as well!

To be honest I thought -fail-on-error would already work like this... I got surprised with an error code today when trying to use it with some "INFO" level infractions 😢

@mateioprea
Copy link

mateioprea commented Jun 16, 2022

If someone guides me a bit on how to approach the tests, I might be able to do them (0 experience with go). I'm also waiting for this to land so it's in our best interest. 😁

@carmanchris31 carmanchris31 marked this pull request as ready for review August 1, 2022 00:40
@carmanchris31
Copy link
Contributor Author

Finally found some time to add tests for the updated conclusion method.

I just want to double check a couple things:

  1. I believe the possible values for "annotation_level" are "notice", "warning", and "failure" based on https://docs.github.com/en/rest/checks/runs but can't find any guarantee that this is the case.
  2. Do we want "notice"-level annotations to result in a "neutral" conclusion or "success"? I currently have it count as "neutral" but could see wanting to reserve that for warnings.

Copy link

@romenrg romenrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really looking forward to seeing this merged. This is a much needed feature indeed for all of us using https://github.com/reviewdog/action-eslint.

The current behavior of our GitHub Actions that use action-eslint is as follows:

  • As I have tested and can be seen in the existing source code, the value of the level param seems to translate to the behavior we want as a conclusion of the action-eslint check when there are >0 annotations.
    • So, if we specify error (or don't specify a value for level, since this is the default behavior), then as soon as there is one warning (or notice), the GHA conclusion will be an failure
    • On the other hand, if we specify warning the GHA won't fail even if there are 200 errors

This behavior of the level param struck me as a weird one. But let's accept it as valid.

Having said that, what makes sense would be to have the result of the action be dependent on the type of annotations that are present in the linting output, in order to be able to actually only fail if there are errors (while being able to report warnings without failing when there are no errors).

This desired behavior is what this PR solves, and it looks good to me.
Thank you @carmanchris31 !

Looking forward to seeing this merged and being able to use a new version of action-eslint with this expected behavior soon

@romenrg
Copy link

romenrg commented Aug 19, 2022

P.S. Regarding:

Do we want "notice"-level annotations to result in a "neutral" conclusion or "success"? I currently have it count as "neutral" but could see wanting to reserve that for warnings.

I don't have a strong opinion. I think I also lean towards counting them as "neutral"

@shakefu
Copy link

shakefu commented Aug 19, 2022

@mgrachev Could you please take a look at this?

@carmanchris31 carmanchris31 force-pushed the fix/calculate-conclusion-from-annotations branch from ed9f295 to a923587 Compare September 5, 2022 19:38
@carmanchris31
Copy link
Contributor Author

Addressed the merge conflict

@jordemort
Copy link
Contributor

Looking forward to this; after it is merged, I can fix jordemort/action-pyright#31

@adis-io
Copy link

adis-io commented Oct 21, 2022

Any update on this?

@carmanchris31
Copy link
Contributor Author

It's been a good while with no activity. What can we do to move this forward?

@romenrg
Copy link

romenrg commented Dec 14, 2022

@haya14busa, any chance we can get this approved?
It's a pretty relevant improvement, the PR is solid and it's been several months already.
It is only pending a quick approval from a maintainer.

@danieleades
Copy link

it'd be a great christmas present. I have a couple of long-running PRs waiting on this

@danieleades
Copy link

P.S. Regarding:

Do we want "notice"-level annotations to result in a "neutral" conclusion or "success"? I currently have it count as "neutral" but could see wanting to reserve that for warnings.

I don't have a strong opinion. I think I also lean towards counting them as "neutral"

github actions don't support a neutral status do they?

@carmanchris31
Copy link
Contributor Author

P.S. Regarding:

Do we want "notice"-level annotations to result in a "neutral" conclusion or "success"? I currently have it count as "neutral" but could see wanting to reserve that for warnings.

I don't have a strong opinion. I think I also lean towards counting them as "neutral"

github actions don't support a neutral status do they?

Probably not, but this is for the result of a check run which does.

@danieleades
Copy link

has this stalled?

@carmanchris31
Copy link
Contributor Author

has this stalled?

@danieleades yes unfortunately... we just need the right person to approve and merge...

@jordemort
Copy link
Contributor

@haya14busa Can you help with this?

@carmanchris31
Copy link
Contributor Author

Trying again... @haya14busa can you please merge this for us?

This is a substantial quality of life improvement that has been ready for 8 months now. 🙏

@jordemort
Copy link
Contributor

Perhaps @i-sevostyanov can help?

Copy link
Contributor

@i-sevostyanov i-sevostyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@i-sevostyanov i-sevostyanov merged commit db1c834 into reviewdog:master May 20, 2023
@review-dog
Copy link
Member

Hi, @carmanchris31! We merged your PR to reviewdog! 🐶
Thank you for your contribution! ✨

We just invited you to join the @reviewdog organization on GitHub.
Accept the invite by visiting https://github.com/orgs/reviewdog/invitation.
By joining the team, you'll be a part of reviewdog community and can help the maintenance of reviewdog.

Thanks again!

@carmanchris31 carmanchris31 deleted the fix/calculate-conclusion-from-annotations branch May 21, 2023 17:21
carmanchris31 added a commit to carmanchris31/reviewdog that referenced this pull request May 26, 2023
Since reviewdog#1170 we can dynamically calculate the check conclusion from annotations if a level config isn't provided. However, reviewdog defaulted level to error, which prevented the dynamic calculation from ever running.
@carmanchris31
Copy link
Contributor Author

Followup required: #1426

shogo82148 added a commit that referenced this pull request Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet