Based on this stackoverflow question, this is a GitHub Action for annotating the commits based on your Pytest coverage report.
- Generates
pytestreport leveragingcoveragelibrary (present insrc/entrypoint.shfile). More specifically, these set of commands are run :This generates achanged_files=$(git diff --name-only --diff-filter=AM "$PR_BASE_SHA" "$PR_HEAD_SHA" | grep '\.py$' | tr '\n' ' ') python -m coverage run -m pytest $changed_files python -m coverage json
coverage.jsonreport file. This respects the.coveragercfile present in the root of the repository. - Next, a Python script (
src/main.py) parses the file and generateswarningannotations using the GitHub Check runs API. We only generate50annotations in a single run since that's the limit specified by the API specifications.