Skip to content

Commit fa670a2

Browse files
committed
more prefix features
1 parent b84a88a commit fa670a2

7 files changed

Lines changed: 150 additions & 17 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ venv.bak/
102102

103103
# mypy
104104
.mypy_cache/
105+
106+
# Docs tmp files
107+
docs/tags_list.txt

docs/conf.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,29 @@
5050
# relative to this directory. They are copied after the builtin static files,
5151
# so a file named "default.css" will overwrite the builtin "default.css".
5252
html_static_path = ["_static"]
53+
54+
# Add a table of the supported PR types, tags, etc
55+
from github_activity.github_activity import TAGS_METADATA_BASE
56+
57+
table_content = []
58+
for key, vals in TAGS_METADATA_BASE.items():
59+
cont = [
60+
key,
61+
" ".join(vals["tags"]),
62+
" ".join(vals["pre"]),
63+
f'"{vals["description"]}"',
64+
]
65+
table_content.append(", ".join(cont))
66+
67+
table_content = "\n".join(table_content)
68+
table_template = f"""
69+
```{{csv-table}} List of PR types
70+
:header: PR type, Tags, Prefix, Description
71+
72+
{table_content}
73+
```
74+
"""
75+
76+
from pathlib import Path
77+
78+
Path("./tags_list.txt").write_text(table_template)

docs/index.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,26 @@ You can find the [resulting markdown here](sample_notebook_activity).
5252

5353
### Splitting PRs by tags and prefixes
5454

55-
Often you wish to split your PRs into multiple categories. `github-activity`
55+
Often you wish to split your PRs into multiple categories so that they are easier
56+
to scan and parse. You may also *only* want to keep some PRs (e.g. features, or API
57+
changes) while excluding others from your changelog.
58+
59+
`github-activity` uses the GitHub tags as well as PR prefixes to automatically
60+
categorize each PR and display it in a section in your markdown. It roughly
5661
follows the [keepachangelog taxonomy of changes](https://keepachangelog.com/en/1.0.0/).
5762

63+
Below is a list of the supported PR types, as well as the tags / title prefixes
64+
that will be used to identify the right category.
65+
66+
```{include} tags_list.txt
67+
```
68+
69+
```{tip}
70+
You can choose to *remove* some types of PRs from your changelog by passing the
71+
`--tags` parameter in the CLI. This is a list of a subset of names taken from the
72+
left-most column above.
73+
```
74+
5875
### Using a GitHub API token
5976

6077
`github-activity` uses the GitHub API to pull information about a repository's activity.
@@ -94,4 +111,4 @@ contributor is anyone who has:
94111
* Commented on >= 2 issues that weren't theirs
95112
* Commented >= 6 times on any one issue
96113

97-
We'd love feedback on whether this is a good set of rules to use.
114+
We'd love feedback on whether this is a good set of rules to use.

github_activity/tags.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
api_change:
2+
description: API and Breaking Changes
3+
pre:
4+
- BREAK
5+
- BREAKING
6+
- BRK
7+
- UPGRADE
8+
tags:
9+
- api-change
10+
- apichange
11+
bug:
12+
description: Bugs fixed
13+
pre:
14+
- FIX
15+
- BUG
16+
tags:
17+
- bug
18+
- bugfix
19+
- bugs
20+
deprecate:
21+
description: Deprecated features
22+
pre:
23+
- DEPRECATE
24+
- DEPRECATION
25+
- DEP
26+
tags:
27+
- deprecation
28+
- deprecate
29+
documentation:
30+
description: Documentation improvements
31+
pre:
32+
- DOC
33+
- DOCS
34+
tags:
35+
- documentation
36+
- docs
37+
- doc
38+
enhancement:
39+
description: Enhancements made
40+
pre:
41+
- NEW
42+
- ENH
43+
- ENHANCEMENT
44+
- IMPROVE
45+
tags:
46+
- enhancement
47+
- enhancements
48+
maintenance:
49+
description: Maintenance and upkeep improvements
50+
pre:
51+
- MAINT
52+
- MNT
53+
tags:
54+
- maintenance
55+
- maint
56+
new:
57+
description: New features added
58+
pre:
59+
- NEW
60+
- FEAT
61+
- FEATURE
62+
tags:
63+
- feature
64+
- new

tests/test_cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ def test_cli(tmpdir, file_regression):
2222
file_regression.check(md, extension=".md")
2323

2424

25-
def test_tags(tmpdir, file_regression):
25+
def test_pr_split(tmpdir, file_regression):
26+
"""Test that PRs are properly split by tags/prefixes."""
2627
path_tmp = Path(tmpdir)
2728
path_output = path_tmp.joinpath("out.md")
2829

29-
url = "https://github.com/executablebooks/sphinx-book-theme"
30+
url = "https://github.com/executablebooks/jupyter-book"
3031

31-
# CLI with URL
32-
cmd = f"github-activity {url} -s v0.0.2 -u v0.0.4 -o {path_output}"
32+
# This release range covers some PRs with tags, and some with prefixes
33+
cmd = f"github-activity {url} -s v0.7.1 -u v0.7.3 -o {path_output}"
3334
out = run(cmd.split(), check=True)
3435
md = path_output.read_text()
36+
md = md.split("## Contributors to this release")[0]
3537
file_regression.check(md, extension=".md")

tests/test_cli/test_pr_split.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# v0.7.1...v0.7.3
2+
([full changelog](https://github.com/executablebooks/jupyter-book/compare/v0.7.1...v0.7.3))
3+
4+
5+
## New features added
6+
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
7+
8+
## Enhancements made
9+
* 👌 IMPROVE: improving numbered sections [#826](https://github.com/executablebooks/jupyter-book/pull/826) ([@choldgraf](https://github.com/choldgraf))
10+
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
11+
* checking for toc modification time [#772](https://github.com/executablebooks/jupyter-book/pull/772) ([@choldgraf](https://github.com/choldgraf))
12+
* first pass toc directive [#757](https://github.com/executablebooks/jupyter-book/pull/757) ([@choldgraf](https://github.com/choldgraf))
13+
14+
## Bugs fixed
15+
* Fix typo in content-blocks.md documentation [#811](https://github.com/executablebooks/jupyter-book/pull/811) ([@MaxGhenis](https://github.com/MaxGhenis))
16+
* [BUG] Using relative instead of absolute links [#747](https://github.com/executablebooks/jupyter-book/pull/747) ([@AakashGfude](https://github.com/AakashGfude))
17+
* 🐛 FIX: fixing jupytext install/UI links [#737](https://github.com/executablebooks/jupyter-book/pull/737) ([@chrisjsewell](https://github.com/chrisjsewell))
18+
19+
## Documentation improvements
20+
* 📚 DOC: update gh-pages + ghp-import docs [#814](https://github.com/executablebooks/jupyter-book/pull/814) ([@TomasBeuzen](https://github.com/TomasBeuzen))
21+
* 📚 DOC: note about licenses [#806](https://github.com/executablebooks/jupyter-book/pull/806) ([@choldgraf](https://github.com/choldgraf))
22+
* 📖 DOCS: Fix google analytics instructions [#799](https://github.com/executablebooks/jupyter-book/pull/799) ([@tobydriscoll](https://github.com/tobydriscoll))
23+
* Change book_path to path_to_book [#773](https://github.com/executablebooks/jupyter-book/pull/773) ([@MaxGhenis](https://github.com/MaxGhenis))
24+
* GitHub actions example: note about selective build [#771](https://github.com/executablebooks/jupyter-book/pull/771) ([@consideRatio](https://github.com/consideRatio))
25+
* getting sphinx thebelab to work [#749](https://github.com/executablebooks/jupyter-book/pull/749) ([@choldgraf](https://github.com/choldgraf))
26+
* Link documentation for adding cell tags in Jupyter from "Hide or remove content" documentation section [#734](https://github.com/executablebooks/jupyter-book/pull/734) ([@MaxGhenis](https://github.com/MaxGhenis))
27+
* typo fix [#731](https://github.com/executablebooks/jupyter-book/pull/731) ([@MaxGhenis](https://github.com/MaxGhenis))
28+
29+
## API and Breaking Changes
30+
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
31+
* removing config file numbered sections to use toc file instead [#768](https://github.com/executablebooks/jupyter-book/pull/768) ([@choldgraf](https://github.com/choldgraf))
32+

tests/test_cli/test_tags.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)