Skip to content

Commit f7728bd

Browse files
committed
Different task list for the bug slayer
1 parent a23344b commit f7728bd

5 files changed

Lines changed: 40 additions & 9 deletions

File tree

.github/actions/replicate/__tests__/replicate.test.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/replicate/__tests__/replicate.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ This is the issue body second line
7474
const TEST_GENERATED_ISSUE: replicate.Issue = {
7575
title: '[All For One] Issue Title',
7676
labels: ['All For One','not-a-bounty-label'],
77+
bountyType: 'All For One',
7778
body: `Original external [issue](https://github.com/test_owner/test_repo/issues/1)
7879
7980
Sumitted by [ghsecuritylab](https://github.com/ghsecuritylab)

.github/actions/replicate/issues.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getIssueList = async (owner: string, repo: string, token: string |
2525

2626
issues.data.forEach(issue => {
2727
const bountyLabel = checkBountyLabels? issue.labels.some(label => {
28-
return replicate.BOUNTY_LABELS.includes(label.name)
28+
return replicate.BOUNTY_LABELS.includes(label.name as replicate.BountyType)
2929
}) : undefined
3030
if(!checkBountyLabels || bountyLabel){
3131
let item: Issue_info = {

.github/actions/replicate/replicate.js

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/replicate/replicate.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import * as github from '@actions/github'
33
import { WebhookPayload } from '@actions/github/lib/interfaces'
44
import { getIssueList, internalIssueAlreadyCreated, isUserAlreadyParticipant } from './issues'
55

6-
export type Issue = {title: string, body: string, labels: string[]}
7-
export const BOUNTY_LABELS: string[] = ['All For One', 'The Bug Slayer']
8-
const COMMENT_TASK_LIST = `## Task List
6+
export const BOUNTY_LABELS = ['All For One', 'The Bug Slayer'] as const
7+
export type BountyType = typeof BOUNTY_LABELS[number]
8+
type CommentMap = {[K in BountyType]: string}
9+
export type Issue = {title: string, body: string, labels: string[], bountyType: BountyType}
10+
11+
const COMMENT_TASK_LIST_AFO = `## Task List
912
- [ ] Initial assessment - Please record your decision in the comment below
1013
- [ ] CodeQL
1114
- [ ] Security Lab
@@ -21,6 +24,20 @@ const COMMENT_TASK_LIST = `## Task List
2124
- [ ] Bounty Payment
2225
`
2326

27+
const COMMENT_TASK_LIST_BS = `## Task List
28+
- [ ] Initial assessment from Security Lab
29+
- [ ] Security Lab assessment:
30+
- [ ] Confirm the CVE
31+
- [ ] Assess the Vulnerability Impact, the Vulnerability Scope
32+
- [ ] Get the CodeQL scores (False Positive ratio, Code Maturity and the Documentation) from the previous query rating
33+
- [ ] PR is merged? Finalize the score
34+
- [ ] Bounty Payment`
35+
36+
const COMMENT_TASK_LIST: CommentMap = {
37+
'All For One': COMMENT_TASK_LIST_AFO,
38+
'The Bug Slayer': COMMENT_TASK_LIST_BS
39+
}
40+
2441
const COMMENT_SCORING = `## Scoring
2542
| Criterion | Score|
2643
|--- | --- |
@@ -40,7 +57,7 @@ const COMMENT_FIRST_SUBMISSION = `## :tada: First submission for this user :tada
4057

4158
export const generateInternalIssueContentFromPayload = async (payload: WebhookPayload): Promise<Issue | undefined> => {
4259
const issue = payload.issue
43-
let result: Issue = {title: "none", body: "none", labels: []}
60+
let result: Issue = {title: 'none', body: 'none', labels: [], bountyType: 'All For One'}
4461
let bountyIssue: boolean = false
4562
let bountyType = ''
4663

@@ -103,7 +120,7 @@ export const createInternalIssue = async (payload: WebhookPayload, issue: Issue)
103120
owner,
104121
repo,
105122
issue_number: internal_ref,
106-
body: COMMENT_TASK_LIST,
123+
body: COMMENT_TASK_LIST[issue.bountyType],
107124
})
108125
core.debug(`comment created ${issueCommentResponse1.data.url}`)
109126

0 commit comments

Comments
 (0)