Skip to content

feat: add security_advisory_credit reason #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/typesGithub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Reason =
| 'manual'
| 'mention'
| 'review_requested'
| 'security_advisory_credit'
| 'security_alert'
| 'state_change'
| 'subscribed'
Expand Down
17 changes: 12 additions & 5 deletions src/utils/__snapshots__/github-api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -66,41 +66,48 @@ exports[`./utils/github-api.ts should format the notification reason 7`] = `
`;

exports[`./utils/github-api.ts should format the notification reason 8`] = `
{
"description": "You were credited for contributing to a security advisory.",
"type": "Security Advisory Credit",
}
`;

exports[`./utils/github-api.ts should format the notification reason 9`] = `
{
"description": "GitHub discovered a security vulnerability in your repository.",
"type": "Security Alert",
}
`;

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

exports[`./utils/github-api.ts should format the notification reason 10`] = `
exports[`./utils/github-api.ts should format the notification reason 11`] = `
{
"description": "You're watching the repository.",
"type": "Subscribed",
}
`;

exports[`./utils/github-api.ts should format the notification reason 11`] = `
exports[`./utils/github-api.ts should format the notification reason 12`] = `
{
"description": "You were on a team that was mentioned.",
"type": "Team Mention",
}
`;

exports[`./utils/github-api.ts should format the notification reason 12`] = `
exports[`./utils/github-api.ts should format the notification reason 13`] = `
{
"description": "A GitHub Actions workflow run was triggered for your repository",
"type": "Workflow Run",
}
`;

exports[`./utils/github-api.ts should format the notification reason 13`] = `
exports[`./utils/github-api.ts should format the notification reason 14`] = `
{
"description": "The reason for this notification is not supported by the app.",
"type": "Unknown",
Expand Down
1 change: 1 addition & 0 deletions src/utils/github-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('./utils/github-api.ts', () => {
expect(formatReason('manual')).toMatchSnapshot();
expect(formatReason('mention')).toMatchSnapshot();
expect(formatReason('review_requested')).toMatchSnapshot();
expect(formatReason('security_advisory_credit')).toMatchSnapshot();
expect(formatReason('security_alert')).toMatchSnapshot();
expect(formatReason('state_change')).toMatchSnapshot();
expect(formatReason('subscribed')).toMatchSnapshot();
Expand Down
3 changes: 3 additions & 0 deletions src/utils/github-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const DESCRIPTIONS = {
MANUAL: 'You subscribed to the thread (via an issue or pull request).',
MENTION: 'You were specifically @mentioned in the content.',
REVIEW_REQUESTED: "You, or a team you're a member of, were requested to review a pull request.",
SECURITY_ADVISORY_CREDIT: "You were credited for contributing to a security advisory.",
SECURITY_ALERT: 'GitHub discovered a security vulnerability in your repository.',
STATE_CHANGE: 'You changed the thread state (for example, closing an issue or merging a pull request).',
SUBSCRIBED: "You're watching the repository.",
Expand Down Expand Up @@ -55,6 +56,8 @@ export function formatReason(reason: Reason): {
return { type: 'Mention', description: DESCRIPTIONS['MENTION'] };
case 'review_requested':
return { type: 'Review Requested', description: DESCRIPTIONS['REVIEW_REQUESTED'] };
case 'security_advisory_credit':
return { type: 'Security Advisory Credit', description: DESCRIPTIONS['SECURITY_ADVISORY_CREDIT'] };
case 'security_alert':
return { type: 'Security Alert', description: DESCRIPTIONS['SECURITY_ALERT'] };
case 'state_change':
Expand Down