Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

chore: remove review-gate workflow (#478)

Cindy Zhang0addcb3a59cf
diff --git a/.github/workflows/review-gate.yml b/.github/workflows/review-gate.yml
deleted file mode 100644
index c6e0572e78..0000000000
--- a/.github/workflows/review-gate.yml
+++ /dev/null
@@ -1,127 +0,0 @@
-name: Review Gate
-
-on:
- pull_request:
- types: [opened, synchronize, reopened]
- pull_request_review:
- types: [submitted]
- merge_group:
-
-permissions:
- checks: write
- pull-requests: read
-
-jobs:
- review-gate:
- name: review-gate
- runs-on: ubuntu-latest
- steps:
- # In merge queue context, the review already passed on the PR — auto-pass
- - name: Auto-pass for merge queue
- if: github.event_name == 'merge_group'
- run: echo "Merge queue — review already validated on the PR"
-
- - name: Checkout CODEOWNERS
- if: github.event_name != 'merge_group'
- uses: actions/checkout@v4
- with:
- sparse-checkout: .github/CODEOWNERS
- sparse-checkout-cone-mode: false
-
- - name: Check review requirement
- if: github.event_name != 'merge_group'
- uses: actions/github-script@v7
- with:
- script: |
- const fs = require('fs');
-
- // Parse CODEOWNERS for global owners (* pattern)
- const codeowners = fs.readFileSync('.github/CODEOWNERS', 'utf8');
- const globalOwners = new Set();
- for (const line of codeowners.split('\n')) {
- const trimmed = line.trim();
- if (trimmed.startsWith('#') || !trimmed) continue;
- const parts = trimmed.split(/\s+/);
- if (parts[0] === '*') {
- for (let i = 1; i < parts.length; i++) {
- globalOwners.add(parts[i].replace('@', ''));
- }
- }
- }
-
- if (globalOwners.size === 0) {
- core.setFailed('No global code owners found in CODEOWNERS');
- return;
- }
-
- console.log(`Code owners: ${[...globalOwners].join(', ')}`);
-
- const pr = context.payload.pull_request
- ?? (await github.rest.pulls.get({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: context.payload.review?.pull_request?.number
- ?? context.issue.number,
- })).data;
-
- // Auto-pass for code owners' own PRs
- if (globalOwners.has(pr.user.login)) {
- console.log(`PR author ${pr.user.login} is a code owner — auto-approved`);
- return;
- }
-
- // For everyone else, require an approving review from a code owner
- const reviews = await github.rest.pulls.listReviews({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: pr.number,
- });
-
- const latestReviews = new Map();
- for (const review of reviews.data) {
- latestReviews.set(review.user.login, review.state);
- }
-
- const approved = [...globalOwners].some(
- owner => latestReviews.get(owner) === 'APPROVED'
- );
-
- if (approved) {
- const approver = [...globalOwners].find(
- owner => latestReviews.get(owner) === 'APPROVED'
- );
- console.log(`Code owner @${approver} has approved this PR`);
-
- // Neutralize any previous failed review-gate check runs so they
- // don't block merge. GitHub's status rollup considers ALL check
- // runs for a given name — a stale failure poisons the overall
- // result even when the latest run succeeded.
- const checkRuns = await github.rest.checks.listForRef({
- owner: context.repo.owner,
- repo: context.repo.repo,
- ref: pr.head.sha,
- check_name: 'review-gate',
- });
-
- for (const run of checkRuns.data.check_runs) {
- if (run.conclusion === 'failure') {
- console.log(`Neutralizing stale failed check run ${run.id}`);
- await github.rest.checks.update({
- owner: context.repo.owner,
- repo: context.repo.repo,
- check_run_id: run.id,
- conclusion: 'neutral',
- output: {
- title: 'Superseded',
- summary: 'Superseded by a newer review-gate run after code owner approval.',
- },
- });
- }
- }
-
- return;
- }
-
- core.setFailed(
- `Requires an approving review from a code owner (${[...globalOwners].map(o => '@' + o).join(', ')}) before merging.`
- );