diff --git a/.github/workflows/marvin.yml b/.github/workflows/marvin.yml index 7b9c6923e..8d26185a9 100644 --- a/.github/workflows/marvin.yml +++ b/.github/workflows/marvin.yml @@ -33,12 +33,6 @@ jobs: steps: - uses: actions/checkout@v5 - # Set up Python environment - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - # Install UV package manager - name: Install UV uses: astral-sh/setup-uv@v6 @@ -48,7 +42,7 @@ jobs: # Install project dependencies - name: Install dependencies - run: uv sync --dev + run: uv sync --python 3.12 # Install pre-commit hooks automatically - name: Install pre-commit hooks diff --git a/.github/workflows/update-config-schema.yml b/.github/workflows/update-config-schema.yml new file mode 100644 index 000000000..215f94413 --- /dev/null +++ b/.github/workflows/update-config-schema.yml @@ -0,0 +1,93 @@ +name: Update Config Schema + +# This workflow runs on merges to main to automatically update the config schema +# by creating a PR when changes are needed. + +on: + push: + branches: ["main"] + paths: + - "src/fastmcp/utilities/fastmcp_config/**" + - "!src/fastmcp/utilities/fastmcp_config/v1/schema.json" # Exclude the local schema file + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + update-config-schema: + timeout-minutes: 5 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - 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 }} + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Install dependencies + run: uv sync --python 3.12 + + - name: Generate config schema + run: | + echo "🔄 Generating fastmcp.json schema..." + uv run python -c " + from fastmcp.utilities.fastmcp_config import generate_schema + generate_schema('docs/public/schemas/fastmcp.json/latest.json') + print('✅ Schema generated successfully') + " + + # Also update the v1 schema for consistency + uv run python -c " + from fastmcp.utilities.fastmcp_config import generate_schema + generate_schema('docs/public/schemas/fastmcp.json/v1.json') + print('✅ v1 schema updated') + " + + - name: Check for changes + id: check_changes + run: | + if git diff --quiet docs/public/schemas/fastmcp.json/; then + echo "No changes detected in config schema" + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo "Changes detected in config schema" + echo "has_changes=true" >> $GITHUB_OUTPUT + fi + + - name: Create Pull Request + if: steps.check_changes.outputs.has_changes == 'true' + uses: peter-evans/create-pull-request@v7 + 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/fastmcp_config/` to ensure consistency. + + 🤖 Generated by Marvin + branch: marvin/update-config-schema + 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 + run: | + if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then + echo "✅ Config schema PR created" + else + echo "✅ Config schema is already up to date" + fi diff --git a/.github/workflows/update-sdk-docs.yml b/.github/workflows/update-sdk-docs.yml index 49ae10fe7..a23ff3069 100644 --- a/.github/workflows/update-sdk-docs.yml +++ b/.github/workflows/update-sdk-docs.yml @@ -1,8 +1,7 @@ name: Update SDK Documentation # This workflow runs on merges to main to automatically update SDK docs -# without blocking PRs. SDK doc generation can fail if another PR merges -# first, so handling it post-merge prevents annoying CI failures for contributors. +# by creating a PR when changes are needed. on: push: @@ -23,8 +22,13 @@ jobs: steps: - uses: actions/checkout@v5 + + - name: Generate Marvin App token + id: marvin-token + uses: actions/create-github-app-token@v2 with: - token: ${{ secrets.GITHUB_TOKEN }} + app-id: ${{ secrets.MARVIN_APP_ID }} + private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }} - name: Install uv uses: astral-sh/setup-uv@v6 @@ -32,13 +36,8 @@ jobs: enable-cache: true cache-dependency-glob: "uv.lock" - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install dependencies - run: uv sync --dev + run: uv sync --python 3.12 - name: Install just uses: extractions/setup-just@v3 @@ -59,23 +58,28 @@ jobs: echo "has_changes=true" >> $GITHUB_OUTPUT fi - - name: Commit and push changes + - name: Create Pull Request if: steps.check_changes.outputs.has_changes == 'true' - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add docs/python-sdk/ docs/docs.json - git commit -m "chore: Update SDK documentation + uses: peter-evans/create-pull-request@v7 + 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. - 🤖 Generated with [Claude Code](https://claude.ai/code) + 📚 Documentation is automatically generated from the source code docstrings and type annotations. - Co-Authored-By: Claude " - git push + 🤖 Generated by Marvin + branch: marvin/update-sdk-docs + 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 run: | if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then - echo "✅ SDK documentation updated and committed" + echo "✅ SDK documentation PR created" else echo "✅ SDK documentation is already up to date" fi