🔨 Add pre-commit hook to ensure latest release header has date (#2205)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Motov Yurii
2026-04-03 14:05:03 +02:00
committed by GitHub
parent 041377eb6d
commit 37287deafe
3 changed files with 59 additions and 12 deletions
+7
View File
@@ -60,3 +60,10 @@ repos:
pass_filenames: false
language: unsupported
files: ^backend/.*$|^scripts/generate-client\.sh$
- id: add-release-date
language: unsupported
name: add date to latest release header
entry: uv run python scripts/add_latest_release_date.py
files: ^release-notes\.md$
pass_filenames: false
+12 -12
View File
@@ -52,7 +52,7 @@
* ⬆ 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).
* ⬆ 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).
## 0.10.0
## 0.10.0 (2026-01-23)
### Features
@@ -123,7 +123,7 @@
* ⬆ 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).
* ⬆ 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).
## 0.9.0
## 0.9.0 (2025-12-08)
### Features
@@ -307,7 +307,7 @@
* ⬆ 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).
* 🔧 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).
## 0.8.0
## 0.8.0 (2025-02-19)
### Features
@@ -367,7 +367,7 @@
* 👷 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).
* 👷 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).
## 0.7.1
## 0.7.1 (2024-09-27)
### Highlights
@@ -430,7 +430,7 @@
* 👷 Add GitHub Action add-to-project. PR [#1297](https://github.com/fastapi/full-stack-fastapi-template/pull/1297) by [@tiangolo](https://github.com/tiangolo).
* 👷 Update issue-manager. PR [#1288](https://github.com/fastapi/full-stack-fastapi-template/pull/1288) by [@tiangolo](https://github.com/tiangolo).
## 0.7.0
## 0.7.0 (2024-08-02)
Lots of new things! 🎁
@@ -575,7 +575,7 @@ Lots of new things! 🎁
* 🔥 Delete leftover celery file. PR [#727](https://github.com/tiangolo/full-stack-fastapi-template/pull/727) by [@dr-neptune](https://github.com/dr-neptune).
* ⚙️ 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).
## 0.6.0
## 0.6.0 (2024-03-12)
Latest FastAPI, Pydantic, SQLModel 🚀
@@ -759,7 +759,7 @@ Test cov > 90% ✅
* Add [GitHub Sponsors](https://github.com/sponsors/tiangolo) button. PR [#201](https://github.com/tiangolo/full-stack-fastapi-template/pull/201).
* Simplify scripts and development, update docs and configs. PR [#155](https://github.com/tiangolo/full-stack-fastapi-template/pull/155).
## 0.5.0
## 0.5.0 (2020-04-19)
* 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).
* 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% ✅
* 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).
* Add normal user testing Pytest fixture. PR [#20](https://github.com/tiangolo/full-stack-fastapi-template/pull/20) by [@ebreton](https://github.com/ebreton).
## 0.4.0
## 0.4.0 (2019-05-29)
* Fix security on resetting a password. Receive token as body, not query. PR [#34](https://github.com/tiangolo/full-stack-fastapi-template/pull/34).
@@ -806,7 +806,7 @@ Test cov > 90% ✅
* Update Jupyter Lab installation and util script/environment variable for local development.
## 0.3.0
## 0.3.0 (2019-04-19)
* PR <a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/14" target="_blank">#14</a>:
* Update CRUD utils to use types better.
@@ -821,11 +821,11 @@ Test cov > 90% ✅
* 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>.
## 0.2.2
## 0.2.2 (2019-04-11)
* 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>.
## 0.2.1
## 0.2.1 (2019-03-29)
* 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.
@@ -833,7 +833,7 @@ Test cov > 90% ✅
* Update generated README.
## 0.2.0
## 0.2.0 (2019-03-11)
**<a href="https://github.com/tiangolo/full-stack-fastapi-template/pull/2" target="_blank">PR #2</a>**:
+40
View File
@@ -0,0 +1,40 @@
"""Check release-notes.md and add today's date to the latest release header if missing."""
import re
import sys
from datetime import date
RELEASE_NOTES_FILE = "release-notes.md"
RELEASE_HEADER_PATTERN = re.compile(r"^## (\d+\.\d+\.\d+)\s*(\(.*\))?\s*$")
def main() -> None:
with open(RELEASE_NOTES_FILE) as f:
lines = f.readlines()
for i, line in enumerate(lines):
match = RELEASE_HEADER_PATTERN.match(line)
if not match:
continue
version = match.group(1)
date_part = match.group(2)
if date_part:
print(f"Latest release {version} already has a date: {date_part}")
sys.exit(0)
today = date.today().isoformat()
lines[i] = f"## {version} ({today})\n"
print(f"Added date: {version} ({today})")
with open(RELEASE_NOTES_FILE, "w") as f:
f.writelines(lines)
sys.exit(0)
print("No release header found")
sys.exit(1)
if __name__ == "__main__":
main()