PR review agent: avoid approving eval-risk behavior changes #604
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: API breakage checks | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| sdk-api: | |
| name: SDK programmatic API (Griffe) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Install workspace deps (dev) | |
| run: uv sync --frozen --group dev | |
| - name: Run SDK API breakage check | |
| id: api_breakage | |
| # Release PRs (rel-*) must block on breakage. | |
| # Other PRs should still report failures via PR comment, but not gate merges. | |
| continue-on-error: ${{ !startsWith(github.head_ref, 'rel-') }} | |
| run: | | |
| uv run python .github/scripts/check_sdk_api_breakage.py 2>&1 | tee api-breakage.log | |
| echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT" | |
| exit "${PIPESTATUS[0]}" | |
| - name: Post API breakage report to PR | |
| if: ${{ always() && github.event_name == 'pull_request' }} | |
| uses: actions/github-script@v7 | |
| env: | |
| EXIT_CODE: ${{ steps.api_breakage.outputs.exit_code }} | |
| LOG_PATH: api-breakage.log | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const marker = '<!-- api-breakage-report -->'; | |
| const exitCode = Number(process.env.EXIT_CODE || '0'); | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| let body = `${marker}\n### API breakage checks (Griffe)\n\nResult: ${exitCode === 0 ? 'Passed' : 'Failed'}\n`; | |
| if (exitCode !== 0) { | |
| let log = ''; | |
| try { | |
| log = fs.readFileSync(process.env.LOG_PATH, 'utf8'); | |
| } catch (e) { | |
| log = `Unable to read log file: ${e}`; | |
| } | |
| const excerpt = log.slice(0, 1000).replace(/```/g, '``\\`'); | |
| body += `\n<details><summary>Log excerpt (first 1000 characters)</summary>\n\n\`\`\`text\n${excerpt}\n\`\`\`\n\n</details>\n`; | |
| } | |
| body += `\n[Action log](${runUrl})\n`; | |
| const { owner, repo } = context.repo; | |
| const issue_number = context.issue.number; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner, | |
| repo, | |
| issue_number, | |
| per_page: 100, | |
| }); | |
| const existing = comments.find((c) => c.body && c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner, | |
| repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number, | |
| body, | |
| }); | |
| } |