Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ repos:
require_serial: true
language: unsupported
pass_filenames: false


- 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
8 changes: 4 additions & 4 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* ⬆ 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).
* 👷 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).

## 0.0.4
## 0.0.4 (2025-11-10)

### Fixes

Expand All @@ -48,7 +48,7 @@
* ⬆ 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).
* ⬆ 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).

## 0.0.3
## 0.0.3 (2025-10-24)

### Docs

Expand All @@ -60,7 +60,7 @@

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

## 0.0.2
## 0.0.2 (2025-10-22)

### Features

Expand All @@ -74,6 +74,6 @@
* 🔧 Add configs for `.github`. PR [#1](https://github.com/fastapi/annotated-doc/pull/1) by [@tiangolo](https://github.com/tiangolo).
* 🔧 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).

## 0.0.1
## 0.0.1 (2023-12-11)

Reserve PyPI package.
40 changes: 40 additions & 0 deletions scripts/add_latest_release_date.py
Original file line number Diff line number Diff line change
@@ -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()
Loading