Skip to content

Commit 728d44a

Browse files
authored
feat: add member_feature_requested reason (#806)
* feat: add member_feature_requested reason * feat: add member_feature_requested reason
1 parent 203f78e commit 728d44a

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

src/typesGithub.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
export type Reason =
22
| 'assign'
33
| 'author'
4+
| 'ci_activity'
45
| 'comment'
56
| 'invitation'
67
| 'manual'
8+
| 'member_feature_requested'
79
| 'mention'
810
| 'review_requested'
911
| 'security_alert'
1012
| 'state_change'
1113
| 'subscribed'
12-
| 'team_mention'
13-
| 'ci_activity';
14+
| 'team_mention';
1415

1516
export type SubjectType =
1617
| 'CheckSuite'

src/utils/__snapshots__/github-api.test.ts.snap

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,76 +31,83 @@ exports[`./utils/github-api.ts should format the notification reason 2`] = `
3131
`;
3232

3333
exports[`./utils/github-api.ts should format the notification reason 3`] = `
34+
{
35+
"description": "A GitHub Actions workflow run was triggered for your repository",
36+
"type": "Workflow Run",
37+
}
38+
`;
39+
40+
exports[`./utils/github-api.ts should format the notification reason 4`] = `
3441
{
3542
"description": "You commented on the thread.",
3643
"type": "Comment",
3744
}
3845
`;
3946

40-
exports[`./utils/github-api.ts should format the notification reason 4`] = `
47+
exports[`./utils/github-api.ts should format the notification reason 5`] = `
4148
{
4249
"description": "You accepted an invitation to contribute to the repository.",
4350
"type": "Invitation",
4451
}
4552
`;
4653

47-
exports[`./utils/github-api.ts should format the notification reason 5`] = `
54+
exports[`./utils/github-api.ts should format the notification reason 6`] = `
4855
{
4956
"description": "You subscribed to the thread (via an issue or pull request).",
5057
"type": "Manual",
5158
}
5259
`;
5360

54-
exports[`./utils/github-api.ts should format the notification reason 6`] = `
61+
exports[`./utils/github-api.ts should format the notification reason 7`] = `
62+
{
63+
"description": "Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.",
64+
"type": "Member Feature Requested",
65+
}
66+
`;
67+
68+
exports[`./utils/github-api.ts should format the notification reason 8`] = `
5569
{
5670
"description": "You were specifically @mentioned in the content.",
5771
"type": "Mention",
5872
}
5973
`;
6074

61-
exports[`./utils/github-api.ts should format the notification reason 7`] = `
75+
exports[`./utils/github-api.ts should format the notification reason 9`] = `
6276
{
6377
"description": "You, or a team you're a member of, were requested to review a pull request.",
6478
"type": "Review Requested",
6579
}
6680
`;
6781

68-
exports[`./utils/github-api.ts should format the notification reason 8`] = `
82+
exports[`./utils/github-api.ts should format the notification reason 10`] = `
6983
{
7084
"description": "GitHub discovered a security vulnerability in your repository.",
7185
"type": "Security Alert",
7286
}
7387
`;
7488

75-
exports[`./utils/github-api.ts should format the notification reason 9`] = `
89+
exports[`./utils/github-api.ts should format the notification reason 11`] = `
7690
{
7791
"description": "You changed the thread state (for example, closing an issue or merging a pull request).",
7892
"type": "State Change",
7993
}
8094
`;
8195

82-
exports[`./utils/github-api.ts should format the notification reason 10`] = `
96+
exports[`./utils/github-api.ts should format the notification reason 12`] = `
8397
{
8498
"description": "You're watching the repository.",
8599
"type": "Subscribed",
86100
}
87101
`;
88102

89-
exports[`./utils/github-api.ts should format the notification reason 11`] = `
103+
exports[`./utils/github-api.ts should format the notification reason 13`] = `
90104
{
91105
"description": "You were on a team that was mentioned.",
92106
"type": "Team Mention",
93107
}
94108
`;
95109

96-
exports[`./utils/github-api.ts should format the notification reason 12`] = `
97-
{
98-
"description": "A GitHub Actions workflow run was triggered for your repository",
99-
"type": "Workflow Run",
100-
}
101-
`;
102-
103-
exports[`./utils/github-api.ts should format the notification reason 13`] = `
110+
exports[`./utils/github-api.ts should format the notification reason 14`] = `
104111
{
105112
"description": "The reason for this notification is not supported by the app.",
106113
"type": "Unknown",

src/utils/github-api.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ describe('./utils/github-api.ts', () => {
99
it('should format the notification reason', () => {
1010
expect(formatReason('assign')).toMatchSnapshot();
1111
expect(formatReason('author')).toMatchSnapshot();
12+
expect(formatReason('ci_activity')).toMatchSnapshot();
1213
expect(formatReason('comment')).toMatchSnapshot();
1314
expect(formatReason('invitation')).toMatchSnapshot();
1415
expect(formatReason('manual')).toMatchSnapshot();
16+
expect(formatReason('member_feature_requested')).toMatchSnapshot();
1517
expect(formatReason('mention')).toMatchSnapshot();
1618
expect(formatReason('review_requested')).toMatchSnapshot();
1719
expect(formatReason('security_alert')).toMatchSnapshot();
1820
expect(formatReason('state_change')).toMatchSnapshot();
1921
expect(formatReason('subscribed')).toMatchSnapshot();
2022
expect(formatReason('team_mention')).toMatchSnapshot();
21-
expect(formatReason('ci_activity')).toMatchSnapshot();
2223
expect(formatReason('something_else_unknown' as Reason)).toMatchSnapshot();
2324
});
2425

src/utils/github-api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const DESCRIPTIONS = {
2525
COMMENT: 'You commented on the thread.',
2626
INVITATION: 'You accepted an invitation to contribute to the repository.',
2727
MANUAL: 'You subscribed to the thread (via an issue or pull request).',
28+
MEMBER_FEATURE_REQUESTED: 'Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.',
2829
MENTION: 'You were specifically @mentioned in the content.',
2930
REVIEW_REQUESTED: "You, or a team you're a member of, were requested to review a pull request.",
3031
SECURITY_ALERT: 'GitHub discovered a security vulnerability in your repository.',
@@ -51,6 +52,8 @@ export function formatReason(reason: Reason): {
5152
return { type: 'Invitation', description: DESCRIPTIONS['INVITATION'] };
5253
case 'manual':
5354
return { type: 'Manual', description: DESCRIPTIONS['MANUAL'] };
55+
case 'member_feature_requested':
56+
return { type: 'Member Feature Requested', description: DESCRIPTIONS['MEMBER_FEATURE_REQUESTED'] };
5457
case 'mention':
5558
return { type: 'Mention', description: DESCRIPTIONS['MENTION'] };
5659
case 'review_requested':

0 commit comments

Comments
 (0)