Skip to content

Commit

Permalink
Avoid adding waiting for product owner if issue is unrouted (#557)
Browse files Browse the repository at this point in the history
* avoid adding waiting for product owner if issue is unrouted
  • Loading branch information
hubertdeng123 authored Jul 27, 2023
1 parent 32362a4 commit 1dc70ea
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GH_APP_SECRET_KEY="top \nsecret\n key"
GH_ORGS_YML="test/github-orgs.yml"
SENTRY_REPO_SLUG="sentry"
GETSENTRY_REPO_SLUG="getsentry"
GETSENTRY_ORG_SLUG="getsentry"

# Slack
SLACK_SIGNING_SECRET="slacksigningsecret"
Expand Down
1 change: 1 addition & 0 deletions github-orgs.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ your-org-CHANGEME:
appAuth:
appId: ''
privateKey: 'GH_APP_PRIVATE_KEY' # leave this, it names an env var to pull from
installationId: ''
project:
nodeId: ''
fieldIds:
Expand Down
7 changes: 7 additions & 0 deletions src/brain/issueLabelHandler/followups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function isNotWaitingForLabel(payload) {
return !payload.label?.name.startsWith(WAITING_FOR_LABEL_PREFIX);
}

function isWaitingForSupport(payload) {
return payload.issue.labels.some(
({ name }) => name === WAITING_FOR_SUPPORT_LABEL
);
}

function isContractor(payload) {
// Contractors are outside collaborators on GitHub
return payload.comment.author_association === 'COLLABORATOR';
Expand All @@ -51,6 +57,7 @@ export async function updateCommunityFollowups({
const reasonsToDoNothing = [
isNotInARepoWeCareAboutForFollowups,
isNotFromAnExternalOrGTMUser,
isWaitingForSupport,
isContractor,
isPullRequest,
isFromABot,
Expand Down
9 changes: 9 additions & 0 deletions src/brain/issueLabelHandler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ describe('issueLabelHandler', function () {
expect(org.api.issues._labels).toEqual(new Set([]));
});

it('should not add `Waiting for: Product Owner` label when community member comments and issue is waiting for support', async function () {
await createPR('routing-repo');
await addLabel(WAITING_FOR_SUPPORT_LABEL);
await addComment('routing-repo', 'Skywalker', true);
expect(org.api.issues._labels).toEqual(
new Set([WAITING_FOR_SUPPORT_LABEL])
);
});

it('should add `Waiting for: Product Owner` label when community member comments and issue is not waiting for community', async function () {
await setupIssue();
await addComment('routing-repo', 'Skywalker');
Expand Down

0 comments on commit 1dc70ea

Please sign in to comment.