Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
iolave committed Sep 2, 2024
1 parent 09a0d32 commit 358df59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions commander/sync.cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ syncCmd.action(async () => {
logger.debug(logName, "created new github client");

const project = new GithubProject(gh);
logger.info(logName, "loading github project", { id: args.ghProjectId })
const initErr = await project.init(args.ghProjectId);
if (initErr) return util.error(initErr);

Expand All @@ -98,6 +99,7 @@ syncCmd.action(async () => {
const [userRes, userErr] = await jira.users.searchByEmail(jiraEmail!);
if (userErr) return util.error(userErr);
args.ghAssigneesMap[ghUser] = userRes.accountId;
logger.debug(logName, "mapped github user", { ghUser, jiraEmail, jiraAccountId: userRes.accountId });
}

do {
Expand All @@ -107,12 +109,12 @@ syncCmd.action(async () => {
for (const pi of items) {
// TODO: if task already have a jira issue sync issue and task
if (pi.jiraUrl) {
logger.debug(logName, "skipping creation, issue already created", { title: pi.title, url: pi.jiraUrl });
logger.debug(logName, "skipping creation, issue already created", { itemId: pi.id, title: pi.title, url: pi.jiraUrl });

continue;
}

logger.info(logName, "creating jira issue", { title: pi.title });
logger.info(logName, "creating jira issue", { itemId: pi.id, title: pi.title });
var accountId = "";
if (args.ghAssigneesMap) accountId = pi.assignee ? args.ghAssigneesMap[pi.assignee] ?? "" : "";

Expand All @@ -127,7 +129,7 @@ syncCmd.action(async () => {
continue;
}

logger.info(logName, "created issue", { url: createRes.issueUrl });
logger.info(logName, "created issue", { itemId: pi.id, url: createRes.issueUrl });
// UPDATE URL FIELD
const updateUrlErr = await project.updateJiraUrl(pi.id, createRes.issueUrl);
if (updateUrlErr) logger.error(logName, "unable to update jira url in github", updateUrlErr);
Expand All @@ -143,11 +145,11 @@ syncCmd.action(async () => {
for (const t of transitions) {
const err = await jira.issues.transition(createRes.issueKey, t);
if (!err) {
logger.info(logName, `transitioned task "${createRes.issueKey}" with transition "${t}"`);
logger.info(logName, `transitioned task "${createRes.issueKey}" with transition "${t}"`, { itemId: pi.id });
continue;
}

logger.error(logName, `unable to transition task "${createRes.issueKey}" with transition "${t}"`);
logger.error(logName, `unable to transition task "${createRes.issueKey}" with transition "${t}"`, { itemId: pi.id });
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jira-tickets-from-gh",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"module": "index.ts",
"type": "module",
"bin": {
Expand Down

0 comments on commit 358df59

Please sign in to comment.