Skip to content

Commit 8b9051e

Browse files
authored
chore: make it ready for v2 (#28)
Update commands for publish Add docs for annotations
1 parent a62479a commit 8b9051e

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ report:
2626
pipenv run pytest tests --cov-branch --cov=codecov --cov-report=term-missing --cov-report=json:/tmp/report.json
2727

2828
build:
29-
python3 -m build
29+
pipenv run python3 -m build
30+
31+
test-publish:
32+
pipenv run python3 -m twine upload --repository testpypi dist/*
3033

3134
publish:
32-
python3 -m twine upload dist/*
35+
pipenv run python3 -m twine upload dist/*
3336

3437
run:
3538
pipenv run python run.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Permissions needed for the Github Token:
1515
`Pull requests:write`
1616

1717
If you have given `ANNOTATIONS_DATA_BRANCH` branch then Github Token also requires content write permissions.
18-
Read more on how to use this here.
18+
Read more on how to use this [here](./docs/annotations.md).
1919

2020
`Contents:write`
2121

docs/annotations.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# How Annotations Work
2+
3+
Annotations in this context are similar to GitHub annotations or workflow commands,
4+
displaying a banner in the GitHub pull request.
5+
When the option `ANNOTATE_MISSING_LINES=True` is enabled, annotations are generated for lines missing coverage.
6+
To include branch coverage in these annotations, enable `BRANCH_COVERAGE=True`.
7+
By default, these annotations are written to the console, but you can also choose to save them elsewhere.
8+
9+
## Storing Annotations
10+
11+
1. **To a File**:
12+
- Set the file path in `ANNOTATIONS_OUTPUT_PATH`.
13+
14+
2. **To a Branch**:
15+
- Set the branch name in `ANNOTATIONS_DATA_BRANCH`.
16+
- Ensure your GitHub token has `Contents:write` permissions.
17+
- Make sure the branch exists and is not protected by branch protection rules.
18+
- Annotations are stored with the filename `{PR-number}-annotations.json`,
19+
where `{PR-number}` is replaced by the actual PR number.
20+
- Existing annotations for a PR in the branch will be overwritten if the file already exist in branch.
21+
- If the GitHub token user has email privacy enabled, the email format `{id}+{login}@users.noreply.github.com` is used.
22+
Where `{id}` is the user ID and `{login}` is the username.
23+
24+
## Using the Annotations
25+
26+
After generating the annotations, you can enable this extension.
27+
A URL is required where the annotations are accessible from the extension, with a placeholder for the PR number.
28+
For example:
29+
`https://raw.githubusercontent.com/PradeepTammali/python-coverage-comment/data/coverage-annotations/{PR-NUMBER}-annotations.json`
30+
31+
The `{PR-NUMBER}` placeholder will be replaced with the actual PR number when viewing the PR diff.

0 commit comments

Comments
 (0)