in src/main.ts [6:50]
async function main(
issueFilePath: string,
apiKey: string,
teamId: string,
stateId: string,
isDryrun: boolean,
embed: string
) {
if (apiKey === undefined || apiKey === "") {
throw new UndefinedError("apiKey");
}
if (teamId === undefined || teamId === "") {
throw new UndefinedError("teamId");
}
if (stateId === undefined || stateId === "") {
throw new UndefinedError("stateId");
}
if (
issueFilePath === undefined ||
issueFilePath === "" ||
!issueFilePath.endsWith(".md")
) {
throw new UndefinedError("issueFilePath");
}
const replaceRecords = parseEmbed(embed);
info("--- view embed ---");
info(JSON.stringify(replaceRecords, null, 2));
const client = new Linear(apiKey, teamId, stateId, isDryrun);
info(`--- create ${issueFilePath} ---`);
const data = readFileSync(issueFilePath);
const issueData = client.readData(data, replaceRecords);
info(JSON.stringify(issueData, null, 2));
if (isDryrun) {
info(`--- !!DRYRUN!! ---`);
}
const result = await client.createIssue();
info(`--- result ${issueFilePath} ---`);
info(JSON.stringify(result, null, 2));
info(`--- done ${issueFilePath} ---`);
}