Skip to content

Implement Rust MCP server to verify Auth feature #8

Implement Rust MCP server to verify Auth feature

Implement Rust MCP server to verify Auth feature #8

name: PR Format Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
rust-format:
name: Rust Format
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check changed files
id: changed-files
run: |
# Get list of changed Rust files (excluding third_party)
git diff --name-only origin/${{ github.base_ref }}...HEAD | \
grep -E '\.rs$' | \
grep -v '^third_party/' > changed_files.txt || true
if [ -s changed_files.txt ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Changed Rust files:"
cat changed_files.txt
else
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No Rust files changed"
fi
- name: Check formatting
if: steps.changed-files.outputs.has_changes == 'true'
run: |
cargo fmt --all -- --check
- name: Post PR comment on failure
if: failure() && steps.changed-files.outputs.has_changes == 'true'
uses: actions/github-script@v7
with:
script: |
const comment = `## Rust Format Check Failed
Some Rust files in this PR are not properly formatted.
**To fix this issue:**
\`\`\`bash
cargo fmt
\`\`\`
Then commit and push the changes.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});