Skip to content

Commit 553a2cb

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pin-actions-by-sha
2 parents 86a1b8c + 6de1da5 commit 553a2cb

File tree

5 files changed

+118
-66
lines changed

5 files changed

+118
-66
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ repos:
4040
require_serial: true
4141
language: unsupported
4242
pass_filenames: false
43+
44+
45+
- id: add-release-date
46+
language: unsupported
47+
name: add date to latest release header
48+
entry: uv run python scripts/add_latest_release_date.py
49+
files: ^release-notes\.md$
50+
pass_filenames: false

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ tests = [
4949
"coverage[toml]>=7.6.1",
5050
"mypy==1.14.1",
5151
"pytest>=8.3.5",
52-
"ruff==0.15.4",
52+
"ruff==0.15.8",
5353
"smokeshow>=0.5.0",
5454
"ty>=0.0.9",
5555
"typing-extensions>=4.13.2 ; python_full_version < '3.9'",

release-notes.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
### Internal
1010

11+
* 🔨 Add pre-commit hook to ensure latest release header has date. PR [#38](https://github.com/fastapi/annotated-doc/pull/38) by [@YuriiMotov](https://github.com/YuriiMotov).
12+
* ⬆ Bump prek from 0.3.4 to 0.3.8. PR [#45](https://github.com/fastapi/annotated-doc/pull/45) by [@dependabot[bot]](https://github.com/apps/dependabot).
13+
* ⬆ Bump ty from 0.0.21 to 0.0.27. PR [#46](https://github.com/fastapi/annotated-doc/pull/46) by [@dependabot[bot]](https://github.com/apps/dependabot).
14+
* ⬆ Bump ruff from 0.15.4 to 0.15.8. PR [#47](https://github.com/fastapi/annotated-doc/pull/47) by [@dependabot[bot]](https://github.com/apps/dependabot).
1115
* 👷 Add `ty` to precommit. PR [#43](https://github.com/fastapi/annotated-doc/pull/43) by [@svlandeg](https://github.com/svlandeg).
1216
* ⬆ Bump actions/upload-artifact from 6 to 7. PR [#40](https://github.com/fastapi/annotated-doc/pull/40) by [@dependabot[bot]](https://github.com/apps/dependabot).
1317
* ⬆ Bump actions/download-artifact from 7 to 8. PR [#39](https://github.com/fastapi/annotated-doc/pull/39) by [@dependabot[bot]](https://github.com/apps/dependabot).
@@ -29,7 +33,7 @@
2933
* ⬆ Bump actions/checkout from 5 to 6. PR [#20](https://github.com/fastapi/annotated-doc/pull/20) by [@dependabot[bot]](https://github.com/apps/dependabot).
3034
* 👷 Upgrade `latest-changes` GitHub Action and pin `actions/checkout@v5`. PR [#21](https://github.com/fastapi/annotated-doc/pull/21) by [@svlandeg](https://github.com/svlandeg).
3135

32-
## 0.0.4
36+
## 0.0.4 (2025-11-10)
3337

3438
### Fixes
3539

@@ -45,7 +49,7 @@
4549
* ⬆ Bump actions/upload-artifact from 4 to 5. PR [#14](https://github.com/fastapi/annotated-doc/pull/14) by [@dependabot[bot]](https://github.com/apps/dependabot).
4650
* ⬆ Bump actions/download-artifact from 5 to 6. PR [#13](https://github.com/fastapi/annotated-doc/pull/13) by [@dependabot[bot]](https://github.com/apps/dependabot).
4751

48-
## 0.0.3
52+
## 0.0.3 (2025-10-24)
4953

5054
### Docs
5155

@@ -57,7 +61,7 @@
5761

5862
* 🔧 Add PEP-639 license metadata. PR [#11](https://github.com/fastapi/annotated-doc/pull/11) by [@bollwyvl](https://github.com/bollwyvl).
5963

60-
## 0.0.2
64+
## 0.0.2 (2025-10-22)
6165

6266
### Features
6367

@@ -71,6 +75,6 @@
7175
* 🔧 Add configs for `.github`. PR [#1](https://github.com/fastapi/annotated-doc/pull/1) by [@tiangolo](https://github.com/tiangolo).
7276
* 🔧 Update latest-changes config to point to `main` as the main branch. PR [#2](https://github.com/fastapi/annotated-doc/pull/2) by [@tiangolo](https://github.com/tiangolo).
7377

74-
## 0.0.1
78+
## 0.0.1 (2023-12-11)
7579

7680
Reserve PyPI package.

scripts/add_latest_release_date.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Check release-notes.md and add today's date to the latest release header if missing."""
2+
3+
import re
4+
import sys
5+
from datetime import date
6+
7+
RELEASE_NOTES_FILE = "release-notes.md"
8+
RELEASE_HEADER_PATTERN = re.compile(r"^## (\d+\.\d+\.\d+)\s*(\(.*\))?\s*$")
9+
10+
11+
def main() -> None:
12+
with open(RELEASE_NOTES_FILE) as f:
13+
lines = f.readlines()
14+
15+
for i, line in enumerate(lines):
16+
match = RELEASE_HEADER_PATTERN.match(line)
17+
if not match:
18+
continue
19+
20+
version = match.group(1)
21+
date_part = match.group(2)
22+
23+
if date_part:
24+
print(f"Latest release {version} already has a date: {date_part}")
25+
sys.exit(0)
26+
27+
today = date.today().isoformat()
28+
lines[i] = f"## {version} ({today})\n"
29+
print(f"Added date: {version} ({today})")
30+
31+
with open(RELEASE_NOTES_FILE, "w") as f:
32+
f.writelines(lines)
33+
sys.exit(0)
34+
35+
print("No release header found")
36+
sys.exit(1)
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)