Files
mcp-use__mcp-use/.github/workflows/conformance-comment.yml

99 lines
3.4 KiB
YAML

name: Post Conformance Comment
on:
workflow_run:
workflows: ["MCP Conformance Tests"]
types:
- completed
permissions:
pull-requests: write
issues: write
jobs:
comment:
name: Post Conformance Results Comment
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion != 'cancelled' &&
github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download conformance results
id: download-results
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: conformance-results
path: conformance-results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Post comment using action
if: steps.download-results.outcome == 'success'
uses: mcp-use/mcp-conformance-action@v1
with:
mode: comment
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-mode: update
- name: Download TypeScript v2 results
id: download-typescript-results
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: typescript-v2-conformance-results
path: typescript-v2-conformance-results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Post current-head TypeScript scores
if: steps.download-typescript-results.outcome == 'success'
uses: actions/github-script@v7
env:
RESULTS_ROOT: typescript-v2-conformance-results
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs')
const path = require('path')
const root = process.env.RESULTS_ROOT
const summaryPath = path.join(root, 'summary.md')
if (!fs.existsSync(summaryPath)) {
core.setFailed(`Missing TypeScript conformance summary: ${summaryPath}`)
return
}
const body = fs.readFileSync(summaryPath, 'utf8').trim()
const marker = '<!-- mcp-use-typescript-conformance-results -->'
const issue = context.payload.workflow_run.pull_requests?.[0]
if (!issue) {
core.info('Conformance workflow was not associated with a pull request')
return
}
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
per_page: 100,
})
const comment = `${marker}\n## TypeScript Conformance (current head)\n\n${body}`
const existing = comments.find((item) => item.body?.includes(marker))
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: comment,
})
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: comment,
})
}