From d068ad96cd273a4b6a77b21f87c06de6791d727b Mon Sep 17 00:00:00 2001 From: Krishna R <52176783+krishnarao22@users.noreply.github.com> Date: Sun, 6 Aug 2023 18:55:04 +0400 Subject: [PATCH] Fixes #312 (#329) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vojtěch Jelínek --- actions/src/issues/checkIssueLabels.js | 19 ++++++------------- spec/checkIssueLabelsSpec.js | 19 +++++-------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/actions/src/issues/checkIssueLabels.js b/actions/src/issues/checkIssueLabels.js index 5f31ccda..e151ed87 100644 --- a/actions/src/issues/checkIssueLabels.js +++ b/actions/src/issues/checkIssueLabels.js @@ -50,12 +50,14 @@ const checkLabels = async () => { const handleGoodFirstIssueLabel = async (octokit, user) => { const issueNumber = context.payload.issue.number; // Comment on the issue and ping the onboarding team lead. + var commentBody = ( + 'Hi @' + user + ', only certain users are allowed to add good ' + + 'first issue labels. Looping in @oppia/oppia-good-first-issue-labelers ' + + 'to add the label. Thanks!' + ); await octokit.issues.createComment( { - body: 'Hi @' + user + ', thanks for proposing this as a good first ' + - 'issue. I am removing the label for now and looping in ' + - '@' + whitelist.teamLeads.onboardingTeam + ' to approve the label. ' + - 'It will be added back if approved. Thanks!', + body: commentBody, issue_number: issueNumber, owner: context.repo.owner, repo: context.repo.repo, @@ -69,15 +71,6 @@ const handleGoodFirstIssueLabel = async (octokit, user) => { owner: context.repo.owner, repo: context.repo.repo }); - - // Assign issue to Team Lead. - core.info(`Assigning to ${whitelist.teamLeads.onboardingTeam}.`); - await octokit.issues.addAssignees({ - issue_number: issueNumber, - owner: context.repo.owner, - repo: context.repo.repo, - assignees: [whitelist.teamLeads.onboardingTeam], - }); }; /** diff --git a/spec/checkIssueLabelsSpec.js b/spec/checkIssueLabelsSpec.js index 9b2909fd..027f7982 100644 --- a/spec/checkIssueLabelsSpec.js +++ b/spec/checkIssueLabelsSpec.js @@ -80,10 +80,11 @@ describe('Check Issue Labels Module', () => { expect(octokit.issues.createComment).toHaveBeenCalled(); const user = payload.sender.login; const body = ( - 'Hi @' + user + ', thanks for proposing this as a good first issue. ' + - 'I am removing the label for now and looping in ' + - '@' + whitelist.teamLeads.onboardingTeam + ' to approve the label. ' + - 'It will be added back if approved. Thanks!'); + 'Hi @' + user + ', only certain users are allowed to add good ' + + 'first issue labels. ' + + 'Looping in @oppia/oppia-good-first-issue-labelers ' + + 'to add the label. Thanks!' + ); expect(octokit.issues.createComment).toHaveBeenCalledWith({ issue_number: payload.issue.number, @@ -102,16 +103,6 @@ describe('Check Issue Labels Module', () => { repo: payload.repository.name, }); }); - - it('should assign team lead', () => { - expect(octokit.issues.addAssignees).toHaveBeenCalled(); - expect(octokit.issues.addAssignees).toHaveBeenCalledWith({ - issue_number: payload.issue.number, - assignees: [whitelist.teamLeads.onboardingTeam], - owner: payload.repository.owner.login, - repo: payload.repository.name, - }); - }); }); describe('check for good first issue by whitelisted user', () => {