Skip to content

Commit

Permalink
added comment to description
Browse files Browse the repository at this point in the history
  • Loading branch information
maira-samtek committed Apr 4, 2024
1 parent 8ce8d15 commit 6baa0d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
13 changes: 4 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ try {
return descriptionStr;
}

async function createSnykJiraTicket(vulnerability) {
async function createSnykJiraTicket(vulnerability, comment='') {
try {

const title = vulnerability.title.replaceAll("\"", "\\\"");
Expand All @@ -339,14 +339,13 @@ try {

const customFieldKeyValue = core.getInput('jira-custom-field-key-value') ? JSON.parse(core.getInput('jira-custom-field-key-value')) : null;
const customJiraFields = customFieldKeyValue ? { ...customFieldKeyValue } : null;

const issue = {
"fields": {
"project": {
"key": `${core.getInput('jira-project-key')}`
},
"summary": `${core.getInput('jira-title-prefix')} ${vulnerability.title}`,
"description": `${ core.getInput('snyk-test-type') === 'iac' ? iacDescriptionStr(vulnerability) : vulnerability.description}`,
"description": `${comment}${ core.getInput('snyk-test-type') === 'iac' ? iacDescriptionStr(vulnerability) : vulnerability.description}`,
"issuetype": {
"name": `${core.getInput('jira-issue-type')}`
},
Expand Down Expand Up @@ -409,17 +408,13 @@ try {
`Current Version is : ${vulnerability.version} and New Version recommendations : ${fixedIn}`
);
if(fixedIn.length && isMajorVersion(vulnerability.version, fixedIn[0])){
const comment = `For this vulnerability, current version is : ${vulnerability.version} and new version recommendations : ${fixedIn}`;
console.log('This version update is major update')
console.log(
`Creating Jira ticket for vulnerability: ${vulnerability.title}`
);
const resp = await createSnykJiraTicket(vulnerability);
const resp = await createSnykJiraTicket(vulnerability, comment);
console.log(resp)
try{
await commentOnIssue(resp.key, `For this vuln, Current Version is : ${vulnerability.version} and New Version recommendations : ${fixedIn}`)
} catch(e) {
console.log('Error while commenting on the issue: ', e)
}
} else {
console.log('skipping because not major update')
}
Expand Down

0 comments on commit 6baa0d6

Please sign in to comment.