Skip to content

Commit d85243d

Browse files
authored
chore: Automate docs and schema updates via PRs (#1611)
1 parent 5795871 commit d85243d

File tree

3 files changed

+117
-26
lines changed

3 files changed

+117
-26
lines changed

.github/workflows/marvin.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v5
3535

36-
# Set up Python environment
37-
- name: Set up Python
38-
uses: actions/setup-python@v5
39-
with:
40-
python-version: "3.12"
41-
4236
# Install UV package manager
4337
- name: Install UV
4438
uses: astral-sh/setup-uv@v6
@@ -48,7 +42,7 @@ jobs:
4842

4943
# Install project dependencies
5044
- name: Install dependencies
51-
run: uv sync --dev
45+
run: uv sync --python 3.12
5246

5347
# Install pre-commit hooks automatically
5448
- name: Install pre-commit hooks
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Update FastMCPConfig Schema
2+
3+
# This workflow runs on merges to main to automatically update the config schema
4+
# by creating a PR when changes are needed.
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
paths:
10+
- "src/fastmcp/utilities/fastmcp_config/**"
11+
- "!src/fastmcp/utilities/fastmcp_config/v1/schema.json" # Exclude the local schema file
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
update-config-schema:
20+
timeout-minutes: 5
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v5
25+
26+
- name: Generate Marvin App token
27+
id: marvin-token
28+
uses: actions/create-github-app-token@v2
29+
with:
30+
app-id: ${{ secrets.MARVIN_APP_ID }}
31+
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v6
35+
with:
36+
enable-cache: true
37+
cache-dependency-glob: "uv.lock"
38+
39+
- name: Install dependencies
40+
run: uv sync --python 3.12
41+
42+
- name: Generate config schema
43+
run: |
44+
echo "🔄 Generating fastmcp.json schema..."
45+
uv run python -c "
46+
from fastmcp.utilities.fastmcp_config import generate_schema
47+
generate_schema('docs/public/schemas/fastmcp.json/latest.json')
48+
print('✅ Schema generated successfully')
49+
"
50+
51+
# Also update the v1 schema for consistency
52+
uv run python -c "
53+
from fastmcp.utilities.fastmcp_config import generate_schema
54+
generate_schema('docs/public/schemas/fastmcp.json/v1.json')
55+
print('✅ v1 schema updated')
56+
"
57+
58+
- name: Check for changes
59+
id: check_changes
60+
run: |
61+
if git diff --quiet docs/public/schemas/fastmcp.json/; then
62+
echo "No changes detected in config schema"
63+
echo "has_changes=false" >> $GITHUB_OUTPUT
64+
else
65+
echo "Changes detected in config schema"
66+
echo "has_changes=true" >> $GITHUB_OUTPUT
67+
fi
68+
69+
- name: Create Pull Request
70+
if: steps.check_changes.outputs.has_changes == 'true'
71+
uses: peter-evans/create-pull-request@v7
72+
with:
73+
token: ${{ steps.marvin-token.outputs.token }}
74+
commit-message: "chore: Update fastmcp.json schema"
75+
title: "chore: Update fastmcp.json schema"
76+
body: |
77+
This PR updates the fastmcp.json schema files to match the current source code.
78+
79+
The schema is automatically generated from `src/fastmcp/utilities/fastmcp_config/` to ensure consistency.
80+
81+
🤖 Generated by Marvin
82+
branch: marvin/update-config-schema
83+
delete-branch: true
84+
author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"
85+
committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"
86+
87+
- name: Summary
88+
run: |
89+
if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then
90+
echo "✅ Config schema PR created"
91+
else
92+
echo "✅ Config schema is already up to date"
93+
fi

.github/workflows/update-sdk-docs.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Update SDK Documentation
22

33
# This workflow runs on merges to main to automatically update SDK docs
4-
# without blocking PRs. SDK doc generation can fail if another PR merges
5-
# first, so handling it post-merge prevents annoying CI failures for contributors.
4+
# by creating a PR when changes are needed.
65

76
on:
87
push:
@@ -23,22 +22,22 @@ jobs:
2322

2423
steps:
2524
- uses: actions/checkout@v5
25+
26+
- name: Generate Marvin App token
27+
id: marvin-token
28+
uses: actions/create-github-app-token@v2
2629
with:
27-
token: ${{ secrets.GITHUB_TOKEN }}
30+
app-id: ${{ secrets.MARVIN_APP_ID }}
31+
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
2832

2933
- name: Install uv
3034
uses: astral-sh/setup-uv@v6
3135
with:
3236
enable-cache: true
3337
cache-dependency-glob: "uv.lock"
3438

35-
- name: Set up Python
36-
uses: actions/setup-python@v5
37-
with:
38-
python-version: "3.12"
39-
4039
- name: Install dependencies
41-
run: uv sync --dev
40+
run: uv sync --python 3.12
4241

4342
- name: Install just
4443
uses: extractions/setup-just@v3
@@ -59,23 +58,28 @@ jobs:
5958
echo "has_changes=true" >> $GITHUB_OUTPUT
6059
fi
6160
62-
- name: Commit and push changes
61+
- name: Create Pull Request
6362
if: steps.check_changes.outputs.has_changes == 'true'
64-
run: |
65-
git config --local user.email "[email protected]"
66-
git config --local user.name "GitHub Action"
67-
git add docs/python-sdk/ docs/docs.json
68-
git commit -m "chore: Update SDK documentation
63+
uses: peter-evans/create-pull-request@v7
64+
with:
65+
token: ${{ steps.marvin-token.outputs.token }}
66+
commit-message: "chore: Update SDK documentation"
67+
title: "chore: Update SDK documentation"
68+
body: |
69+
This PR updates the auto-generated SDK documentation to reflect the latest source code changes.
6970
70-
🤖 Generated with [Claude Code](https://claude.ai/code)
71+
📚 Documentation is automatically generated from the source code docstrings and type annotations.
7172
72-
Co-Authored-By: Claude <[email protected]>"
73-
git push
73+
🤖 Generated by Marvin
74+
branch: marvin/update-sdk-docs
75+
delete-branch: true
76+
author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"
77+
committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"
7478

7579
- name: Summary
7680
run: |
7781
if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then
78-
echo "✅ SDK documentation updated and committed"
82+
echo "✅ SDK documentation PR created"
7983
else
8084
echo "✅ SDK documentation is already up to date"
8185
fi

0 commit comments

Comments
 (0)