Generate annotations when running inside GitHub Action workflows
Opened this issue · 0 comments
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