Skip to content

Commit

Permalink
Fixes #312 (#329)
Browse files Browse the repository at this point in the history
Co-authored-by: Vojtěch Jelínek <vojtech.jelinek@hey.com>
  • Loading branch information
krishnarao22 and vojtechjelinek authored Aug 6, 2023
1 parent 008ba60 commit d068ad9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
19 changes: 6 additions & 13 deletions actions/src/issues/checkIssueLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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],
});
};

/**
Expand Down
19 changes: 5 additions & 14 deletions spec/checkIssueLabelsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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', () => {
Expand Down

0 comments on commit d068ad9

Please sign in to comment.