π The fast, Pythonic way to build MCP servers and clients.
CI: Commit generated artifacts back to PR branch instead of opening separate PRs (#3128)
Jeremiah Lowin81a7c83c6776
diff --git a/.github/workflows/update-config-schema.yml b/.github/workflows/update-config-schema.ymlindex 06f63234a..e5d0509f4 100644--- a/.github/workflows/update-config-schema.yml+++ b/.github/workflows/update-config-schema.yml@@ -1,28 +1,28 @@name: Update MCPServerConfig Schema-# This workflow runs on merges to main to automatically update the config schema-# by creating a PR when changes are needed.+# 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:- push:+ pull_request:branches: ["main"]paths:- "src/fastmcp/utilities/mcp_server_config/**"- - "!src/fastmcp/utilities/mcp_server_config/v1/schema.json" # Exclude the local schema file+ - "!src/fastmcp/utilities/mcp_server_config/v1/schema.json"workflow_dispatch:permissions:contents: write- pull-requests: writejobs:update-config-schema:timeout-minutes: 5runs-on: ubuntu-latest+ if: >-+ github.event_name == 'workflow_dispatch' ||+ github.event.pull_request.head.repo.full_name == github.repositorysteps:- - uses: actions/checkout@v6-- name: Generate Marvin App tokenid: marvin-tokenuses: actions/create-github-app-token@v2@@ -30,6 +30,11 @@ jobs: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 uvuses: astral-sh/setup-uv@v7with:@@ -41,51 +46,22 @@ jobs:- name: Generate config schemarun: |- echo "π Generating fastmcp.json schema..."-- # Generate schema in docs/public for web accessuv run python -c "from fastmcp.utilities.mcp_server_config import generate_schemagenerate_schema('docs/public/schemas/fastmcp.json/latest.json')- print('β Latest schema generated in docs/public')- "-- # Also update the v1 schema in docs/public- uv run python -c "- from fastmcp.utilities.mcp_server_config import generate_schemagenerate_schema('docs/public/schemas/fastmcp.json/v1.json')- print('β v1 schema generated in docs/public')- "-- # Generate schema in the source directory for local development- uv run python -c "- from fastmcp.utilities.mcp_server_config import generate_schemagenerate_schema('src/fastmcp/utilities/mcp_server_config/v1/schema.json')- print('β Schema generated in utilities/mcp_server_config/v1/')"- - name: Create Pull Request- uses: peter-evans/create-pull-request@v8- with:- token: ${{ steps.marvin-token.outputs.token }}- commit-message: "chore: Update fastmcp.json schema"- title: "chore: Update fastmcp.json schema"- body: |- This PR updates the fastmcp.json schema files to match the current source code.-- The schema is automatically generated from `src/fastmcp/utilities/mcp_server_config/` to ensure consistency.-- **Note:** This PR is fully automated and will update itself with any subsequent changes to the schema, or close automatically if the schema becomes up-to-date through other means. Feel free to leave it open until you're ready to merge.-- π€ Generated by Marvin- branch: marvin/update-config-schema- labels: |- ignore in release notes- delete-branch: true- author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"- committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"-- - name: Summary+ - name: Commit and push if changedrun: |- echo "β Config schema generation workflow completed"- echo "PR will be created if there are changes, or closed if schema is already up to date"+ 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"+ fidiff --git a/.github/workflows/update-sdk-docs.yml b/.github/workflows/update-sdk-docs.ymlindex 10baa1e3f..122f6ddfc 100644--- a/.github/workflows/update-sdk-docs.yml+++ b/.github/workflows/update-sdk-docs.yml@@ -1,10 +1,10 @@name: Update SDK Documentation-# This workflow runs on merges to main to automatically update SDK docs-# by creating a PR when changes are needed.+# Regenerates SDK docs on PRs and commits them back to the branch,+# so the PR is self-contained and main is correct after merge.on:- push:+ pull_request:branches: ["main"]paths:- "src/**"@@ -13,16 +13,16 @@ on:permissions:contents: write- pull-requests: writejobs:update-sdk-docs:timeout-minutes: 5runs-on: ubuntu-latest+ if: >-+ github.event_name == 'workflow_dispatch' ||+ github.event.pull_request.head.repo.full_name == github.repositorysteps:- - uses: actions/checkout@v6-- name: Generate Marvin App tokenid: marvin-tokenuses: actions/create-github-app-token@v2@@ -30,6 +30,11 @@ jobs: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 uvuses: astral-sh/setup-uv@v7with:@@ -43,32 +48,17 @@ jobs:uses: extractions/setup-just@v3- name: Generate SDK documentation- run: |- echo "π Generating SDK documentation..."- just api-ref-all-- - name: Create Pull Request- uses: peter-evans/create-pull-request@v8- with:- token: ${{ steps.marvin-token.outputs.token }}- commit-message: "chore: Update SDK documentation"- title: "chore: Update SDK documentation"- body: |- This PR updates the auto-generated SDK documentation to reflect the latest source code changes.-- π Documentation is automatically generated from the source code docstrings and type annotations.-- **Note:** This PR is fully automated and will update itself with any subsequent changes to the SDK, or close automatically if the documentation becomes up-to-date through other means. Feel free to leave it open until you're ready to merge.-- π€ Generated by Marvin- branch: marvin/update-sdk-docs- labels: |- ignore in release notes- delete-branch: true- author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"- committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"+ run: just api-ref-all- - name: Summary+ - name: Commit and push if changedrun: |- echo "β SDK documentation generation workflow completed"- echo "PR will be created if there are changes, or closed if documentation is already up to date"+ git config user.name "marvin-context-protocol[bot]"+ git config user.email "225465937+marvin-context-protocol[bot]@users.noreply.github.com"+ git add docs/python-sdk/+ if git diff --cached --quiet; then+ echo "SDK documentation is up to date"+ else+ git commit -m "chore: Update SDK documentation"+ git push+ echo "SDK documentation updated and pushed"+ fi