fastmcp/.github/workflows/update-config-schema.yml

67 lines
2.1 KiB
YAML

name: Update MCPServerConfig Schema
# Regenerates config schema on PRs and commits it back to the branch,
# so the PR is self-contained and main is correct after merge.
on:
pull_request:
branches: ["main"]
paths:
- "src/fastmcp/utilities/mcp_server_config/**"
- "!src/fastmcp/utilities/mcp_server_config/v1/schema.json"
workflow_dispatch:
permissions:
contents: write
jobs:
update-config-schema:
timeout-minutes: 5
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Generate Marvin App token
id: marvin-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.MARVIN_APP_ID }}
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref || github.ref }}
token: ${{ steps.marvin-token.outputs.token }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync --python 3.12
- name: Generate config schema
run: |
uv run python -c "
from fastmcp.utilities.mcp_server_config import generate_schema
generate_schema('docs/public/schemas/fastmcp.json/latest.json')
generate_schema('docs/public/schemas/fastmcp.json/v1.json')
generate_schema('src/fastmcp/utilities/mcp_server_config/v1/schema.json')
"
- name: Commit and push if changed
run: |
git config user.name "marvin-context-protocol[bot]"
git config user.email "225465937+marvin-context-protocol[bot]@users.noreply.github.com"
git add docs/public/schemas/ src/fastmcp/utilities/mcp_server_config/v1/schema.json
if git diff --cached --quiet; then
echo "Config schema is up to date"
else
git commit -m "chore: Update fastmcp.json schema"
git push
echo "Config schema updated and pushed"
fi