From 91cae781d722fa2e9a958826f55a2a0f9dfd156b Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Fri, 24 Jan 2025 14:00:06 -0500 Subject: [PATCH] [ci] Make maintainer check workflow usable from other repositories For use in reactjs/react.dev --- .github/workflows/shared_check_maintainer.yml | 12 +++++++++++- .github/workflows/shared_label_core_team_prs.yml | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/shared_check_maintainer.yml b/.github/workflows/shared_check_maintainer.yml index cd43ffe559..0ac11917c9 100644 --- a/.github/workflows/shared_check_maintainer.yml +++ b/.github/workflows/shared_check_maintainer.yml @@ -29,7 +29,17 @@ jobs: script: | const fs = require('fs'); const actor = '${{ inputs.actor }}'; - const data = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' }); + const data = octokit.rest.repos.getContent({ + owner: 'facebook', + repo: 'react', + path: 'MAINTAINERS.md', + ref: 'main', + headers: { + Accept: 'application/vnd.github+json' + } + }); + console.log(data); + // 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`); diff --git a/.github/workflows/shared_label_core_team_prs.yml b/.github/workflows/shared_label_core_team_prs.yml index dc432b54f7..e08b083a9e 100644 --- a/.github/workflows/shared_label_core_team_prs.yml +++ b/.github/workflows/shared_label_core_team_prs.yml @@ -1,7 +1,7 @@ name: (Shared) Label Core Team PRs on: - pull_request_target: + pull_request: env: TZ: /usr/share/zoneinfo/America/Los_Angeles @@ -10,7 +10,7 @@ env: jobs: check_maintainer: - uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main + uses: facebook/react/.github/workflows/shared_check_maintainer.yml@pr32215 with: actor: ${{ github.event.pull_request.user.login }}