mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-09 01:23:17 -05:00
🔧 Add an agent skills note to GitHub releases (#16696)
This commit is contained in:
1 parent
7f696db0ab
commit
bc8b188201
2 files changed
+29
-12
No files matched your search
@@ -18,6 +18,8 @@ hide:
|
||||
|
||||
"""
|
||||
LATEST_CHANGES_HEADER = "## Latest Changes"
|
||||
AGENT_SKILLS_NOTE = """> FastAPI includes an official skill that helps coding agents use new features and recommended patterns for your installed version. Install it with `uvx library-skills` in your project. See [Develop with AI](https://fastapi.tiangolo.com/ai-development/).
|
||||
"""
|
||||
BumpType = Literal["major", "minor", "patch"]
|
||||
|
||||
app = typer.Typer()
|
||||
@@ -204,12 +206,10 @@ def release_notes(
|
||||
],
|
||||
) -> None:
|
||||
version = get_current_version(version_file.read_text(), version_file)
|
||||
typer.echo(
|
||||
get_release_notes_body(
|
||||
release_notes_file.read_text(), version, release_notes_file
|
||||
),
|
||||
nl=False,
|
||||
body = get_release_notes_body(
|
||||
release_notes_file.read_text(), version, release_notes_file
|
||||
)
|
||||
typer.echo(f"{AGENT_SKILLS_NOTE}\n{body}", nl=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -274,23 +274,33 @@ def test_cli_prints_current_version(tmp_path: Path) -> None:
|
||||
assert result.output == "0.136.3\n"
|
||||
|
||||
|
||||
def test_cli_prints_release_notes(tmp_path: Path) -> None:
|
||||
def test_cli_prints_release_notes_with_agent_skills_note(tmp_path: Path) -> None:
|
||||
version_file = tmp_path / "fastapi" / "__init__.py"
|
||||
version_file.parent.mkdir()
|
||||
version_file.write_text('__version__ = "0.136.4"\n')
|
||||
version_content = '__version__ = "0.136.4"\n'
|
||||
version_file.write_text(version_content)
|
||||
release_notes_file = tmp_path / "release-notes.md"
|
||||
release_notes_file.write_text(
|
||||
release_notes_content(
|
||||
"""## Latest Changes
|
||||
notes_content = release_notes_content(
|
||||
"""## Latest Changes
|
||||
|
||||
### Fixes
|
||||
|
||||
* Unreleased fix.
|
||||
|
||||
## 0.136.4 (2026-05-30)
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix something.
|
||||
|
||||
## 0.136.3 (2026-05-23)
|
||||
|
||||
### Fixes
|
||||
|
||||
* Previous fix.
|
||||
"""
|
||||
)
|
||||
)
|
||||
release_notes_file.write_text(notes_content)
|
||||
|
||||
result = runner.invoke(
|
||||
app,
|
||||
@@ -304,4 +314,11 @@ def test_cli_prints_release_notes(tmp_path: Path) -> None:
|
||||
)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert result.output == "### Fixes\n\n* Fix something.\n"
|
||||
note, separator, body = result.output.partition("\n\n")
|
||||
assert note.startswith("> ")
|
||||
assert note.count("`uvx library-skills`") == 1
|
||||
assert "[Develop with AI](https://fastapi.tiangolo.com/ai-development/)" in note
|
||||
assert separator
|
||||
assert body == "### Fixes\n\n* Fix something.\n"
|
||||
assert release_notes_file.read_text() == notes_content
|
||||
assert version_file.read_text() == version_content
|
||||
Reference in new issue
Block a user