Skip to content

Commit 0432bd7

Browse files
committed
not adding already tracked issues
1 parent c698f4e commit 0432bd7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

kbanalysis/src/issues-util.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Octokit } from "@octokit/core";
22
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
33
import * as core from "@actions/core";
4-
import { exit } from "process";
54

65
export async function handleKBIssue(
76
octokit: Octokit & Api,
@@ -22,8 +21,13 @@ export async function handleKBIssue(
2221

2322
if (resp.status == 200) {
2423
let old_body = resp.data.body;
25-
let new_body = old_body + comment;
24+
let action_name = get_action(issue.title);
25+
if (old_body.indexOf(action_name) >= 0) {
26+
core.info(`[!] Action ${action_name} is already being tracked`);
27+
return "Issue already being tracked";
28+
}
2629

30+
let new_body = old_body + comment;
2731
let resp2 = await octokit.rest.issues.updateComment({
2832
owner: owner,
2933
repo: repo,
@@ -95,3 +99,8 @@ async function prepareComment(
9599
body: "unable to fetch analysis",
96100
});
97101
}
102+
103+
function get_action(x) {
104+
x = x.split(" ");
105+
return x[6];
106+
}

0 commit comments

Comments
 (0)