@@ -169,6 +169,7 @@ class IssueContentParser {
169169 const contentLines = issue.body?.split("\n") ?? [];
170170 return contentLines
171171 .filter(x => this.isTaskListLine(x))
172+ .map(x => x.substring(6))
172173 .map(x => (0, utils_1.parseIssueUrl)(x))
173174 .filter((x) => x !== null);
174175 }
@@ -194,6 +195,9 @@ class IssueContentParser {
194195 ...contentLines.slice(sectionEndIndex !== -1 ? sectionEndIndex : contentLines.length),
195196 ].join("\n");
196197 }
198+ isIssueClosed(issue) {
199+ return issue.state === "closed";
200+ }
197201 isIssueContentIdentical(issue, newIssueContent) {
198202 // GitHub automatically replace "\n" to "\r\n" line endings when issue body is modified through GitHub UI.
199203 // Replace "\r\n" to "\n" before comparing content to avoid unnecessary issue updates.
@@ -272,8 +276,16 @@ const run = async () => {
272276 const issueContentParser = new issue_content_parser_1.IssueContentParser();
273277 const mermaidRender = new mermaid_render_1.MermaidRender(inputs.includeLegend);
274278 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+ }
275283 const rootIssueTasklist = issueContentParser.extractIssueTasklist(rootIssue);
276284 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+ }
277289 core.info("Building dependency graph...");
278290 const graphBuilder = new graph_builder_1.GraphBuilder(inputs.includeFinishNode);
279291 for (const issueRef of rootIssueTasklist) {
@@ -435,11 +447,9 @@ ${renderedGraphIssues}
435447`;
436448 }
437449 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};`;
443453 }
444454 renderDependencies(dependencies) {
445455 const renderedDependencies = dependencies.map(x => this.renderDependency(x)).join("\n");
@@ -467,10 +477,10 @@ exports.MermaidRender = MermaidRender;
467477
468478Object.defineProperty(exports, "__esModule", ({ value: true }));
469479exports.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 ;
472482const parseIssueUrl = (str) => {
473- const found = str.match(issueUrlRegex);
483+ const found = str.trim(). match(issueUrlRegex);
474484 if (!found) {
475485 return null;
476486 }
0 commit comments