@intuitionrobotics/bug-report
Version:
29 lines • 1.43 kB
JavaScript
import { ImplementationMissingException, Module } from "@intuitionrobotics/ts-common";
import { JiraModule } from "@intuitionrobotics/jira";
import { Platform_Jira } from "../../index.js";
import {} from "./BugReportModule.js";
export class JiraBugReportIntegrator_Class extends Module {
constructor() {
super("JiraBugReportIntegrator");
}
setIssueTitleProcessor(parser) {
this.parser = parser;
}
parser = (name) => `Bug: ${name}`;
openTicket = async (bugReport, logs, reporter) => {
if (bugReport.platforms && !bugReport.platforms.includes(Platform_Jira))
return;
if (!this.config.jiraProject)
throw new ImplementationMissingException("missing Jira project in bug report configurations");
const description = logs.reduce((carry, log, i) => {
carry.push({ href: log.path, text: "\nClick to view logs (" + i + ")" });
return carry;
}, [bugReport.description]);
if (reporter)
description.push("\nReported by: " + reporter);
const issue = await JiraModule.issue.create(this.config.jiraProject, this.config.issueType, this.parser(bugReport.subject), description, this.config.label?.label);
return { platform: Platform_Jira, issueId: issue.url };
};
}
export const JiraBugReportIntegrator = new JiraBugReportIntegrator_Class();
//# sourceMappingURL=JiraBugReportIntegrator.js.map