From 1185f88d35e83870aa220a30ddcec22ed7e8e362 Mon Sep 17 00:00:00 2001 From: lauren Date: Thu, 16 Jan 2025 15:12:11 -0500 Subject: [PATCH] [ci] Only notify after labeling (#32103) --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32103). * __->__ #32103 * #32102 --- .github/workflows/compiler_discord_notify.yml | 1 + .github/workflows/runtime_discord_notify.yml | 1 + .github/workflows/shared_core_label.yml | 41 ------------------- 3 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/shared_core_label.yml diff --git a/.github/workflows/compiler_discord_notify.yml b/.github/workflows/compiler_discord_notify.yml index febd55764b7a7..b9cc3e9b9fa83 100644 --- a/.github/workflows/compiler_discord_notify.yml +++ b/.github/workflows/compiler_discord_notify.yml @@ -2,6 +2,7 @@ name: (Compiler) Discord Notify on: pull_request_target: + types: [labeled] paths: - compiler/** - .github/workflows/compiler_**.yml diff --git a/.github/workflows/runtime_discord_notify.yml b/.github/workflows/runtime_discord_notify.yml index 18304046d7767..abf7970a1e634 100644 --- a/.github/workflows/runtime_discord_notify.yml +++ b/.github/workflows/runtime_discord_notify.yml @@ -2,6 +2,7 @@ name: (Runtime) Discord Notify on: pull_request_target: + types: [labeled] paths-ignore: - compiler/** - .github/workflows/compiler_**.yml diff --git a/.github/workflows/shared_core_label.yml b/.github/workflows/shared_core_label.yml deleted file mode 100644 index da2c45465eee9..0000000000000 --- a/.github/workflows/shared_core_label.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: (Shared) Core Label - -on: - pull_request_target: - -env: - TZ: /usr/share/zoneinfo/America/Los_Angeles - # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout - SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 - -jobs: - core_label: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Check if actor is maintainer - id: check_maintainer - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const actor = '${{ github.actor }}'; - const data = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' }); - const maintainers = new Set(data.split('\n')); - if (maintainers.has(actor)) { - console.log(`🟢 ${actor} is a maintainer`); - return true; - } - console.log(`🔴 ${actor} is NOT a maintainer`); - return null; - - name: Label PR as React Core Team - if: ${{ steps.check_maintainer.outputs.result }} - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ github.event.number }}, - labels: ['React Core Team'] - });