feat: initial commit from workspace-mcp
Check Maintainer Edits Enabled / check-maintainer-edits (pull_request) Has been cancelled
Check Maintainer Edits Enabled / check-maintainer-edits-internal (pull_request) Has been cancelled
Docker Build and Push to GHCR / build-and-push (pull_request) Has been cancelled
Ruff / ruff (pull_request) Has been cancelled
Check Maintainer Edits Enabled / check-maintainer-edits (pull_request) Has been cancelled
Check Maintainer Edits Enabled / check-maintainer-edits-internal (pull_request) Has been cancelled
Docker Build and Push to GHCR / build-and-push (pull_request) Has been cancelled
Ruff / ruff (pull_request) Has been cancelled
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
name: Check Maintainer Edits Enabled
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
check-maintainer-edits:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.head.repo.fork == true || github.event.pull_request.head.repo.full_name != github.repository
|
||||
|
||||
steps:
|
||||
- name: Check if maintainer edits are enabled
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.issue.number
|
||||
});
|
||||
|
||||
if (!pr.maintainer_can_modify) {
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: '⚠️ **Maintainer edits not enabled**\n\n' +
|
||||
'This repository requires that you enable "Allow edits from maintainers" for your pull request. This allows maintainers to make small fixes and improvements directly to your branch, which speeds up the review process.\n\n' +
|
||||
'**To enable this setting:**\n' +
|
||||
'1. Go to your pull request page\n' +
|
||||
'2. In the right sidebar, look for "Allow edits from maintainers"\n' +
|
||||
'3. Check the checkbox to enable it\n\n' +
|
||||
'Once you\'ve enabled this setting, this check will automatically pass. Thank you! 🙏'
|
||||
});
|
||||
|
||||
core.setFailed('Maintainer edits must be enabled for this pull request');
|
||||
} else {
|
||||
console.log('✅ Maintainer edits are enabled');
|
||||
}
|
||||
|
||||
check-maintainer-edits-internal:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.head.repo.fork == false && github.event.pull_request.head.repo.full_name == github.repository
|
||||
|
||||
steps:
|
||||
- name: Skip check for internal PRs
|
||||
run: |
|
||||
echo "✅ Skipping maintainer edits check for internal pull request"
|
||||
echo "This check only applies to external contributors and forks"
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Docker Build and Push to GHCR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha,prefix=sha-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
@@ -0,0 +1,106 @@
|
||||
name: Publish PyPI + MCP Registry
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Resolve version from tag
|
||||
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Verify tag matches pyproject version
|
||||
run: |
|
||||
PYPROJECT_VERSION="$(python - <<'PY'
|
||||
import tomllib
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
print(data["project"]["version"])
|
||||
PY
|
||||
)"
|
||||
if [ "$PYPROJECT_VERSION" != "$VERSION" ]; then
|
||||
echo "Tag version ($VERSION) does not match pyproject version ($PYPROJECT_VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Sync server.json version with release
|
||||
run: |
|
||||
tmp="$(mktemp)"
|
||||
jq --arg version "$VERSION" '
|
||||
.version = $version
|
||||
| .packages = (
|
||||
(.packages // [])
|
||||
| map(
|
||||
if ((.registryType // .registry_type // "") == "pypi")
|
||||
then .version = $version
|
||||
else .
|
||||
end
|
||||
)
|
||||
)
|
||||
' server.json > "$tmp"
|
||||
mv "$tmp" server.json
|
||||
|
||||
- name: Validate server.json against schema
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install jsonschema requests
|
||||
python - <<'PY'
|
||||
import json
|
||||
import requests
|
||||
from jsonschema import Draft202012Validator
|
||||
|
||||
with open("server.json", "r", encoding="utf-8") as f:
|
||||
instance = json.load(f)
|
||||
|
||||
schema_url = instance["$schema"]
|
||||
schema = requests.get(schema_url, timeout=30).json()
|
||||
|
||||
Draft202012Validator.check_schema(schema)
|
||||
Draft202012Validator(schema).validate(instance)
|
||||
print("server.json schema validation passed")
|
||||
PY
|
||||
|
||||
- name: Build distribution
|
||||
run: |
|
||||
python -m pip install build
|
||||
python -m build
|
||||
|
||||
- name: Check package metadata
|
||||
run: |
|
||||
python -m pip install twine
|
||||
twine check dist/*
|
||||
|
||||
- name: Publish package to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
skip-existing: true
|
||||
|
||||
- name: Install mcp-publisher
|
||||
run: |
|
||||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')"
|
||||
curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_${OS}_${ARCH}.tar.gz" | tar xz mcp-publisher
|
||||
chmod +x mcp-publisher
|
||||
|
||||
- name: Login to MCP Registry with GitHub OIDC
|
||||
run: ./mcp-publisher login github-oidc
|
||||
|
||||
- name: Publish server to MCP Registry
|
||||
run: ./mcp-publisher publish
|
||||
@@ -0,0 +1,45 @@
|
||||
name: Ruff
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
ruff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
- name: Auto-fix ruff lint and format
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
uv run ruff check --fix
|
||||
uv run ruff format
|
||||
- name: Commit and push fixes
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
run: |
|
||||
git diff --quiet && exit 0
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
git commit -m "style: auto-fix ruff lint and format"
|
||||
git push
|
||||
- name: Validate
|
||||
run: |
|
||||
uv run ruff check
|
||||
uv run ruff format --check
|
||||
Reference in New Issue
Block a user