Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix permission and filtering issues for PR review assignments (#51132)
John D. Swanson0634ddb960be
diff --git a/.github/workflows/assign-reviewers.yml b/.github/workflows/assign-reviewers.ymlindex 4853c1c63f4..a77f1812d06 100644--- a/.github/workflows/assign-reviewers.yml+++ b/.github/workflows/assign-reviewers.yml@@ -8,8 +8,8 @@# the zed repo at .github/workflows/assign-reviewers.yml. See INSTALL.md.## AUTH NOTE: Uses a GitHub App (COORDINATOR_APP_ID + COORDINATOR_APP_PRIVATE_KEY)-# to generate an ephemeral token scoped to read-only on the coordinator repo.-# PR operations (team review requests, assignee) use the default GITHUB_TOKEN.+# for all API operations: cloning the private coordinator repo, requesting team+# reviewers, and setting PR assignees. GITHUB_TOKEN is not used.name: Assign Reviewers@@ -17,24 +17,27 @@ on:pull_request:types: [opened, ready_for_review]-permissions:- pull-requests: write- issues: write+# GITHUB_TOKEN is not used — all operations use the GitHub App token.+# Declare minimal permissions so the default token has no write access.+permissions: {}# Only run for PRs from within the org (not forks) — fork PRs don't have-# write access to request team reviewers with GITHUB_TOKEN.+# write access to request team reviewers.jobs:assign-reviewers:- if: github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == false+ if: >-+ github.event.pull_request.head.repo.full_name == github.repository &&+ github.event.pull_request.draft == false &&+ contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.author_association)runs-on: ubuntu-lateststeps:- - name: Generate coordinator repo token+ - name: Generate app tokenid: app-tokenuses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1with:app-id: ${{ vars.COORDINATOR_APP_ID }}private-key: ${{ secrets.COORDINATOR_APP_PRIVATE_KEY }}- repositories: codeowner-coordinator+ repositories: codeowner-coordinator,zed- name: Checkout coordinator repouses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1@@ -55,7 +58,7 @@ jobs:- name: Assign reviewersenv:- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GH_TOKEN: ${{ steps.app-token.outputs.token }}PR_URL: ${{ github.event.pull_request.html_url }}TARGET_REPO: ${{ github.repository }}run: |