-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add support for GitHub annotations in GitHub actions #1052
base: main
Are you sure you want to change the base?
Conversation
This allows to add more formaters based on the same error list.
This allows GitHub to parse it and display annotations on pull requests.
Use REUSE_OUTPUT_FORMAT to allow overriding lint output formats in certain environments (like CI).
Hopefully this will land via fsfe/reuse-tool#1052.
Wow, amazing PR @nijel ! Thank you for this work. I wonder whether it makes sense to keep Do you know whether this GitHub format of errors is also consumed by other programs? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and feedback. The PR looks great overall.
I will write a few patch commits to fix the easy stuff that doesn't need discussion.
Environment | ||
----------- | ||
|
||
.. envvar:: REUSE_OUTPUT_FORMAT | ||
|
||
Specifies output format, one of ``plain``, ``lines``, ``github``, ``json`` | ||
|
||
It behaves same as corresponding command line options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a documented order of precedence here. If both REUSE_OUTPUT_FORMAT
and a CLI flag are used, which takes precedence?
As written in the code, I believe the env var takes precedence. I do not know if this is desirable behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, should quiet
be a valid value here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, what should happen if the value of REUSE_OUTPUT_FORMAT
is invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, seems like I didn't notice this feedback, sorry.
With the current implementation, the environment variable takes precedence. This is intentional to allow having command line configuration and override it by environment if executed in environment which might want different output (as GitHub).
Unknown values are simply discarded, but it might be a better approach to issue a warning.
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
I added a rather silly fallback. Maybe an error should be raised, but I don't want to deal with catching this very obscure error. Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
The first implementation of this consumed the `reuse lint --json` output. It was later patched up to consume the ProjectReport instead, but the docstrings were apparently never adjusted accordingly. Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
--github
to format output according to https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actionsREUSE_OUTPUT_FORMAT
to override output from the environment, this is useful to change output in CI compared to when running in user environment.changelog.d/<directory>/
.AUTHORS.rst
.docs/man/
or elsewhere.the current specification.
changed files.