Skip to content

Commit 6459a7a

Browse files
committed
Add documentationfor news management tool
1 parent 30a5155 commit 6459a7a

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,4 @@ lint = { cmd = "pre-commit run --all-files", help = "Checks all files for CI err
9393
precommit = { cmd = "pre-commit install --install-hooks", help = "Installs the precommit hook" }
9494
report = { cmd = "coverage report", help = "Show coverage report from previously run tests." }
9595
test = { cmd = "pytest -n auto --dist loadfile", help = "Runs tests and save results to a coverage report" }
96+
news-create = { cmd = "python -m scripts.news add", help = "Create a new news fragment for your PR to discord-modmail!"}

scripts/news/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# News Management Tool
2+
3+
This writes a news fragment into a directory called `news/next`, here `next` corresponds to the next version
4+
of `discord-modmail`. If the directory doesn't exist, it means you are in the wrong CWD (current working directory)
5+
or you are running the command for the first time, in which case you need to manually create the folder.
6+
7+
To make a new news fragment, you can run `python -m scripts.news add` or use the poetry task `news-create`. It
8+
will make a new file with a filename using the current date and time, GitHub pull request number and a *hopefully
9+
unique* 6-letter word generated by encoding the news entry text.
10+
11+
When it is time to release `discord-modmail` 🎉, the `build` command would aggregate all the fragments present
12+
in `news/next` directory into a single news file for that version.
13+
14+
15+
## Concepts
16+
17+
### Fragments
18+
19+
Fragments are files describing your latest work, created by the `python -m scripts.news add` command. The files
20+
are created in the `news/next` directory.
21+
22+
### Categories / Types
23+
News entries can be categorized, for example as additions, fixes, removals, and breaking changes. The list
24+
of categories is settable with the types setting in [config.toml](./config.toml). While making a news fragment
25+
entry using the `add` command, you would be asked to specify the `type`.

scripts/news/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def cli_build_news(ctx: click.Context) -> None:
201201

202202
template = CONFIG["core"].get("template")
203203
if not template:
204-
template = Path(Path.cwd(), "scripts/news/default_template.md.jinja")
204+
template = Path(Path.cwd(), "scripts/news/template.md.jinja")
205205
else:
206206
template = Path(Path.cwd(), f"scripts/news/{template}")
207207

scripts/news/config.toml

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[core]
2-
template = "default_template.rst"
3-
41
[types]
52
feature = { name = "Features" }
63
trivial = { name = "Trivial/Internal Changes" }

0 commit comments

Comments
 (0)