Skip to content

Commit 37287de

Browse files
YuriiMotovtiangolo
andauthored
🔨 Add pre-commit hook to ensure latest release header has date (#2205)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
1 parent 041377e commit 37287de

File tree

3 files changed

+59
-12
lines changed

3 files changed

+59
-12
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ repos:
6060
pass_filenames: false
6161
language: unsupported
6262
files: ^backend/.*$|^scripts/generate-client\.sh$
63+
64+
- id: add-release-date
65+
language: unsupported
66+
name: add date to latest release header
67+
entry: uv run python scripts/add_latest_release_date.py
68+
files: ^release-notes\.md$
69+
pass_filenames: false

release-notes.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* ⬆ Bump @types/node from 25.0.9 to 25.0.10. PR [#2149](https://github.com/fastapi/full-stack-fastapi-template/pull/2149) by [@dependabot[bot]](https://github.com/apps/dependabot).
5353
* ⬆ Bump @tanstack/react-router-devtools from 1.153.2 to 1.156.0. PR [#2147](https://github.com/fastapi/full-stack-fastapi-template/pull/2147) by [@dependabot[bot]](https://github.com/apps/dependabot).
5454

55-
## 0.10.0
55+
## 0.10.0 (2026-01-23)
5656

5757
### Features
5858

@@ -123,7 +123,7 @@
123123
* ⬆ Bump vite from 7.2.7 to 7.3.0 in /frontend. PR [#2047](https://github.com/fastapi/full-stack-fastapi-template/pull/2047) by [@dependabot[bot]](https://github.com/apps/dependabot).
124124
* ⬆ Bump react-dom from 19.2.1 to 19.2.3 in /frontend. PR [#2046](https://github.com/fastapi/full-stack-fastapi-template/pull/2046) by [@dependabot[bot]](https://github.com/apps/dependabot).
125125

126-
## 0.9.0
126+
## 0.9.0 (2025-12-08)
127127

128128
### Features
129129

@@ -307,7 +307,7 @@
307307
* ⬆ Bump astral-sh/setup-uv from 5 to 6. PR [#1566](https://github.com/fastapi/full-stack-fastapi-template/pull/1566) by [@dependabot[bot]](https://github.com/apps/dependabot).
308308
* 🔧 Add npm and docker package ecosystems to Dependabot configuration. PR [#1535](https://github.com/fastapi/full-stack-fastapi-template/pull/1535) by [@alejsdev](https://github.com/alejsdev).
309309

310-
## 0.8.0
310+
## 0.8.0 (2025-02-19)
311311

312312
### Features
313313

@@ -367,7 +367,7 @@
367367
* 👷 Tweak generate client to error out if there are errors. PR [#1377](https://github.com/fastapi/full-stack-fastapi-template/pull/1377) by [@tiangolo](https://github.com/tiangolo).
368368
* 👷 Generate and commit client only on same repo PRs, on forks, show the error. PR [#1376](https://github.com/fastapi/full-stack-fastapi-template/pull/1376) by [@tiangolo](https://github.com/tiangolo).
369369

370-
## 0.7.1
370+
## 0.7.1 (2024-09-27)
371371

372372
### Highlights
373373

@@ -430,7 +430,7 @@
430430
* 👷 Add GitHub Action add-to-project. PR [#1297](https://github.com/fastapi/full-stack-fastapi-template/pull/1297) by [@tiangolo](https://github.com/tiangolo).
431431
* 👷 Update issue-manager. PR [#1288](https://github.com/fastapi/full-stack-fastapi-template/pull/1288) by [@tiangolo](https://github.com/tiangolo).
432432

433-
## 0.7.0
433+
## 0.7.0 (2024-08-02)
434434

435435
Lots of new things! 🎁
436436

@@ -575,7 +575,7 @@ Lots of new things! 🎁
575575
* 🔥 Delete leftover celery file. PR [#727](https://github.com/tiangolo/full-stack-fastapi-template/pull/727) by [@dr-neptune](https://github.com/dr-neptune).
576576
* ⚙️ Update pre-commit config with Prettier and ESLint. PR [#714](https://github.com/tiangolo/full-stack-fastapi-template/pull/714) by [@alejsdev](https://github.com/alejsdev).
577577

578-
## 0.6.0
578+
## 0.6.0 (2024-03-12)
579579

580580
Latest FastAPI, Pydantic, SQLModel 🚀
581581

@@ -759,7 +759,7 @@ Test cov > 90% ✅
759759
* Add [GitHub Sponsors](https://github.com/sponsors/tiangolo) button. PR [#201](https://github.com/tiangolo/full-stack-fastapi-template/pull/201).
760760
* Simplify scripts and development, update docs and configs. PR [#155](https://github.com/tiangolo/full-stack-fastapi-template/pull/155).
761761

762-
## 0.5.0
762+
## 0.5.0 (2020-04-19)
763763

764764
* Make the Traefik public network a fixed default of `traefik-public` as done in DockerSwarm.rocks, to simplify development and iteration of the project generator. PR [#150](https://github.com/tiangolo/full-stack-fastapi-template/pull/150).
765765
* Update to PostgreSQL 12. PR [#148](https://github.com/tiangolo/full-stack-fastapi-template/pull/148). by [@RCheese](https://github.com/RCheese).
@@ -784,7 +784,7 @@ Test cov > 90% ✅
784784
* Add new CRUD utils based on DB and Pydantic models. Initial PR [#23](https://github.com/tiangolo/full-stack-fastapi-template/pull/23) by [@ebreton](https://github.com/ebreton).
785785
* Add normal user testing Pytest fixture. PR [#20](https://github.com/tiangolo/full-stack-fastapi-template/pull/20) by [@ebreton](https://github.com/ebreton).
786786

787-
## 0.4.0
787+
## 0.4.0 (2019-05-29)
788788

789789
* Fix security on resetting a password. Receive token as body, not query. PR [#34](https://github.com/tiangolo/full-stack-fastapi-template/pull/34).
790790

@@ -806,7 +806,7 @@ Test cov > 90% ✅
806806

807807
* Update Jupyter Lab installation and util script/environment variable for local development.
808808

809-
## 0.3.0
809+
## 0.3.0 (2019-04-19)
810810

811811
* PR <a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/14" target="_blank">#14</a>:
812812
* Update CRUD utils to use types better.
@@ -821,19 +821,19 @@ Test cov > 90% ✅
821821

822822
* Upgrade Python to 3.7 as Celery is now compatible too. PR <a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/10" target="_blank">#10</a> by <a href="https://github.com/ebreton" target="_blank">@ebreton</a>.
823823

824-
## 0.2.2
824+
## 0.2.2 (2019-04-11)
825825

826826
* Fix frontend hijacking /docs in development. Using latest https://github.com/tiangolo/node-frontend with custom Nginx configs in frontend. <a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/6" target="_blank">PR #6</a>.
827827

828-
## 0.2.1
828+
## 0.2.1 (2019-03-29)
829829

830830
* Fix documentation for *path operation* to get user by ID. <a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/4" target="_blank">PR #4</a> by <a href="https://github.com/mpclarkson" target="_blank">@mpclarkson</a> in FastAPI.
831831

832832
* Set `/start-reload.sh` as a command override for development by default.
833833

834834
* Update generated README.
835835

836-
## 0.2.0
836+
## 0.2.0 (2019-03-11)
837837

838838
**<a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/2" target="_blank">PR #2</a>**:
839839

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)