From b2a339027f821c3dbf78fcfe3d1907515aa5d726 Mon Sep 17 00:00:00 2001 From: "Nicholas Carrigan (he/him)" Date: Fri, 26 Mar 2021 10:19:06 -0700 Subject: [PATCH] feat(tools): add team reviewers (#41603) --- tools/crowdin/actions/pr-creator/action.yml | 8 +++++++- tools/crowdin/actions/pr-creator/index.js | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/crowdin/actions/pr-creator/action.yml b/tools/crowdin/actions/pr-creator/action.yml index 11a35dba602..57bfb7fa2c2 100644 --- a/tools/crowdin/actions/pr-creator/action.yml +++ b/tools/crowdin/actions/pr-creator/action.yml @@ -1,5 +1,5 @@ name: 'Create Crowdin PRs' -description: "Creates a PR by camperbot for Crowdin translation downloads" +description: 'Creates a PR by camperbot for Crowdin translation downloads' runs: using: 'node12' main: './index.js' @@ -29,3 +29,9 @@ inputs: reviewers: description: 'Requested PR reviewers' required: false + team_reviewers: + # Note that this should be a slug, not a full tag + # So a requested review from @freeCodeCamp/dev-team + # Should be passed only as 'dev-team' + description: 'Requested organization team PR reviewers' + required: false diff --git a/tools/crowdin/actions/pr-creator/index.js b/tools/crowdin/actions/pr-creator/index.js index c63824c04f6..382332bb354 100644 --- a/tools/crowdin/actions/pr-creator/index.js +++ b/tools/crowdin/actions/pr-creator/index.js @@ -18,6 +18,8 @@ const githubRoot = require('@actions/github'); const labels = labelsStr.trim().split(/,\s+/); const reviewersStr = core.getInput('reviewers'); const reviewers = reviewersStr.trim().split(/,\s+/); + const teamStr = core.getInput('team_reviewers'); + const team_reviewers = teamStr.trim().split(/,\s+/); const github = githubRoot.getOctokit(token); @@ -84,6 +86,15 @@ const githubRoot = require('@actions/github'); }); console.log(`Requested Reviewers ${reviewers} added to PR`); } + if (team_reviewers && team_reviewers.length) { + await github.pulls.requestReviewers({ + owner, + repo, + pull_number: prNumber, + team_reviewers + }); + console.log(`Requested Team Reviewers ${team_reviewers} added to PR`); + } } catch (error) { core.setFailed(error.message); }