From e71d4205aed6c41b88e3689c76b41da65f5c04c0 Mon Sep 17 00:00:00 2001 From: lauren Date: Tue, 15 Apr 2025 13:02:16 -0400 Subject: [PATCH] [ci] Don't run some checks for non-members/collaborators (#32918) There's really no need to even run the workflow for non-members or collaborators for the labeling and discord notification workflows. We can exit early. --- .github/workflows/compiler_discord_notify.yml | 12 ++++++++++++ .github/workflows/runtime_discord_notify.yml | 12 ++++++++++++ .github/workflows/shared_label_core_team_prs.yml | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/.github/workflows/compiler_discord_notify.yml b/.github/workflows/compiler_discord_notify.yml index 3840e3787b..0c7574bd16 100644 --- a/.github/workflows/compiler_discord_notify.yml +++ b/.github/workflows/compiler_discord_notify.yml @@ -10,7 +10,19 @@ on: permissions: {} jobs: + check_access: + runs-on: ubuntu-latest + outputs: + is_member_or_collaborator: ${{ steps.check_access.outputs.result }} + steps: + - name: Check access + id: check_access + if: ${{ github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR' }} + run: echo "is_member_or_collaborator=true" >> "$GITHUB_OUTPUT" + check_maintainer: + if: ${{ needs.check_access.outputs.is_member_or_collaborator == 'true' }} + needs: [check_access] uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main permissions: # Used by check_maintainer diff --git a/.github/workflows/runtime_discord_notify.yml b/.github/workflows/runtime_discord_notify.yml index ad94e28054..9b7ee8f25b 100644 --- a/.github/workflows/runtime_discord_notify.yml +++ b/.github/workflows/runtime_discord_notify.yml @@ -10,7 +10,19 @@ on: permissions: {} jobs: + check_access: + runs-on: ubuntu-latest + outputs: + is_member_or_collaborator: ${{ steps.check_access.outputs.result }} + steps: + - name: Check access + id: check_access + if: ${{ github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR' }} + run: echo "is_member_or_collaborator=true" >> "$GITHUB_OUTPUT" + check_maintainer: + if: ${{ needs.check_access.outputs.is_member_or_collaborator == 'true' }} + needs: [check_access] uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main permissions: # Used by check_maintainer diff --git a/.github/workflows/shared_label_core_team_prs.yml b/.github/workflows/shared_label_core_team_prs.yml index 2cd9f290e0..ec0b63c177 100644 --- a/.github/workflows/shared_label_core_team_prs.yml +++ b/.github/workflows/shared_label_core_team_prs.yml @@ -11,7 +11,19 @@ env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 jobs: + check_access: + runs-on: ubuntu-latest + outputs: + is_member_or_collaborator: ${{ steps.check_access.outputs.result }} + steps: + - name: Check access + id: check_access + if: ${{ github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR' }} + run: echo "is_member_or_collaborator=true" >> "$GITHUB_OUTPUT" + check_maintainer: + if: ${{ needs.check_access.outputs.is_member_or_collaborator == 'true' }} + needs: [check_access] uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main permissions: # Used by check_maintainer