@@ -169,6 +169,7 @@ class IssueContentParser {
169
169
const contentLines = issue.body?.split("\n") ?? [];
170
170
return contentLines
171
171
.filter(x => this.isTaskListLine(x))
172
+ .map(x => x.substring(6))
172
173
.map(x => (0, utils_1.parseIssueUrl)(x))
173
174
.filter((x) => x !== null);
174
175
}
@@ -194,6 +195,9 @@ class IssueContentParser {
194
195
...contentLines.slice(sectionEndIndex !== -1 ? sectionEndIndex : contentLines.length),
195
196
].join("\n");
196
197
}
198
+ isIssueClosed(issue) {
199
+ return issue.state === "closed";
200
+ }
197
201
isIssueContentIdentical(issue, newIssueContent) {
198
202
// GitHub automatically replace "\n" to "\r\n" line endings when issue body is modified through GitHub UI.
199
203
// Replace "\r\n" to "\n" before comparing content to avoid unnecessary issue updates.
@@ -272,8 +276,16 @@ const run = async () => {
272
276
const issueContentParser = new issue_content_parser_1.IssueContentParser();
273
277
const mermaidRender = new mermaid_render_1.MermaidRender(inputs.includeLegend);
274
278
const rootIssue = await githubApiClient.getIssue(inputs.rootIssue);
279
+ if (issueContentParser.isIssueClosed(rootIssue)) {
280
+ core.info("Skipping generation of mermaid diagram because issue is closed");
281
+ return;
282
+ }
275
283
const rootIssueTasklist = issueContentParser.extractIssueTasklist(rootIssue);
276
284
core.info(`Found ${rootIssueTasklist.length} work items in task list.`);
285
+ if (rootIssueTasklist.length === 0) {
286
+ core.info("Skipping generation of mermaid diagram because there is no issues in tasklist");
287
+ return;
288
+ }
277
289
core.info("Building dependency graph...");
278
290
const graphBuilder = new graph_builder_1.GraphBuilder(inputs.includeFinishNode);
279
291
for (const issueRef of rootIssueTasklist) {
@@ -435,11 +447,9 @@ ${renderedGraphIssues}
435
447
`;
436
448
}
437
449
renderIssue(issue) {
438
- let result = `${issue.nodeId}("${issue.getWrappedTitle()}"):::${issue.status};`;
439
- if (issue.url) {
440
- result += `\nclick ${issue.nodeId} href "${issue.url}" _blank;`;
441
- }
442
- return result;
450
+ const title = issue.getWrappedTitle();
451
+ const linkedTitle = issue.url ? `<a href='${issue.url}' style='text-decoration:none;color: inherit;'>${title}</a>` : title;
452
+ return `${issue.nodeId}("${linkedTitle}"):::${issue.status};`;
443
453
}
444
454
renderDependencies(dependencies) {
445
455
const renderedDependencies = dependencies.map(x => this.renderDependency(x)).join("\n");
@@ -467,10 +477,10 @@ exports.MermaidRender = MermaidRender;
467
477
468
478
Object.defineProperty(exports, "__esModule", ({ value: true }));
469
479
exports.parseIssuesUrls = exports.parseIssueUrl = void 0;
470
- const issueUrlRegex = /github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/i;
471
- const issueUrlsRegex = new RegExp(issueUrlRegex, "ig") ;
480
+ const issueUrlRegex = /^https:\/\/ github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$ /i;
481
+ const issueUrlsRegex = /github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/gi ;
472
482
const parseIssueUrl = (str) => {
473
- const found = str.match(issueUrlRegex);
483
+ const found = str.trim(). match(issueUrlRegex);
474
484
if (!found) {
475
485
return null;
476
486
}
0 commit comments