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

Generate annotations when running inside GitHub Action workflows #610

Open
vitaliyf opened this issue Mar 16, 2024 · 1 comment
Open

Generate annotations when running inside GitHub Action workflows #610

vitaliyf opened this issue Mar 16, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@vitaliyf
Copy link

GitHub supports annotating PRs with comments attached to relevant files/lines - for example, https://github.com/pytest-dev/pytest-github-actions-annotate-failures is a plugin that does this for pytest failures.

Describe the solution you would like

This would be neat to have for deptry when someone runs it inside a GitHub action/workflow since it would visually point at the exact file and line that is causing issues.

It is pretty straightforward to implement - you can see how it's done in the above pytest plugin. At a glance, you already have all relevant information (filename, line number, comment). It can be turned on either with an optional --argument, or automatically detect that it's running within a workflow by inspecting os.environ as is done by pytest plugin: https://github.com/pytest-dev/pytest-github-actions-annotate-failures/blob/v0.2.0/pytest_github_actions_annotate_failures/plugin.py#L36

Additional context

Official documentation for this output format is here: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-setting-a-notice-message

@vitaliyf vitaliyf added the enhancement New feature or request label Mar 16, 2024
@fpgmaas fpgmaas added the good first issue Good for newcomers label Mar 16, 2024
@iloveitaly
Copy link

Curious if anyone has taken a stab at this in a way that we could integrate into the project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants