Skip to content

Commit

Permalink
fix(verbiage): changed variable names to match the verbiage (#216)
Browse files Browse the repository at this point in the history
* fix(verbiage): changed variable names to match the verbiage

* fix(verbiage): renamed issue_key to issue_id

* fix(verbiage): formatted
  • Loading branch information
maira-samtek authored Jul 1, 2024
1 parent 6bb0b32 commit 4985275
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
12 changes: 3 additions & 9 deletions src/libs/jira-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,16 @@ export class Jira {
throw new Error(`Error creating Jira issue: ${e.message}`);
}
}
async linkIssues(
newIssueKey: string,
featureIssueKey: string,
linkType = "Relates"
) {
async linkIssues(newIssueKey: string, issueID: string, linkType = "Relates") {
const linkData = {
type: { name: linkType },
inwardIssue: { key: newIssueKey },
outwardIssue: { key: featureIssueKey },
outwardIssue: { key: issueID },
};

try {
await this.jira.issueLink(linkData);
console.log(
`Successfully linked issue ${newIssueKey} with ${featureIssueKey}`
);
console.log(`Successfully linked issue ${newIssueKey} with ${issueID}`);
} catch (error) {
console.error("Error linking issues:", error);
}
Expand Down
6 changes: 3 additions & 3 deletions src/macpro-security-hub-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,13 @@ export class SecurityHubJiraSync {
let newIssueInfo;
try {
newIssueInfo = await this.jira.createNewIssue(newIssueData);
const feature_key = process.env.JIRA_LINK_ID ?? "";
if (feature_key) {
const issue_id = process.env.JIRA_LINK_ID ?? "";
if (issue_id) {
let linkType = "Relates";
if (process.env.JIRA_LINK_TYPE) {
linkType = process.env.JIRA_LINK_TYPE;
}
await this.jira.linkIssues(newIssueInfo.key, feature_key, linkType);
await this.jira.linkIssues(newIssueInfo.key, issue_id, linkType);
}
} catch (e: any) {
throw new Error(`Error creating Jira issue from finding: ${e.message}`);
Expand Down

0 comments on commit 4985275

Please sign in to comment.