{"action":"created","comment":{"url":"https://api.github.com/repos/cto-ai/incident/pulls/comments/362911081","pull_request_review_id":338210709,"id":362911081,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM2MjkxMTA4MQ==","diff_hunk":"@@ -132,73 +139,81 @@ async function createIncident(authData, user) {\n  * @param {object} authData The user's entered auth data\n  * @param {object} user     The current SDK user\n  */\n-async function searchIncidents(authData, user) {\n+async function searchIncidents(authData) {\n   // Init our PD client\n   const { pagerDutyKey } = authData\n   pd.initializePagerDuty(pagerDutyKey)\n \n   // Get query information from the user\n-  const query = await ux.prompt(searchIncidentsPrompt)\n+  const query = await getSearchQuery()\n \n-  sdk.log('')\n+  await ux.print('')\n   ux.spinner.start('Retrieving incidents')\n   const incidents = await pd.getIncidents(query)\n   ux.spinner.stop('Done!\\n')\n \n   // Nothing found; return early\n   if (!incidents.length) {\n-    sdk.log(ux.colors.blue('No incidents found!'))\n+    await ux.print(ux.colors.blue('No incidents found!'))\n     return incidents\n   }\n \n-  sdk.log(ux.colors.magenta('\\nWe found the following incidents:\\n'))\n-  incidents.map(printIncident)\n+  await ux.print(ux.colors.magenta('\\nWe found the following incidents:'))\n+  const incidentsStr = incidents.map(printIncident)\n+  await ux.print(incidentsStr.join(''))\n }\n \n /**\n  * printIncident pretty prints an incident.\n  */\n function printIncident(incident) {\n-  sdk.log(`\\t${incident.title}`)\n-  sdk.log(`\\t\\tStatus: ${incident.status}`)\n-  sdk.log(`\\t\\tService: ${incident.service.summary}`)\n-  sdk.log(`\\t\\tEscalation Policy: ${incident.escalation_policy.summary}`)\n-  sdk.log(`\\t\\tUrgency: ${incident.urgency}`)\n-  sdk.log(`\\t\\tCreated at: ${incident.created_at}`)\n-  sdk.log(`\\t\\tLast modified: ${incident.last_status_change_at}`)\n+  let incidentStr = `\\n\\t${incident.title}\n+  \\t\\tStatus: ${incident.status}\n+  \\t\\tService: ${incident.service.summary}\n+  \\t\\tEscalation Policy: ${incident.escalation_policy.summary}\n+  \\t\\tUrgency: ${incident.urgency}\n+  \\t\\tCreated at: ${incident.created_at}\n+  \\t\\tLast modified: ${incident.last_status_change_at}`\n   if (incident.assignments.length) {\n-    sdk.log(`\\t\\tPeople assigned:`)\n-    incident.assignments.map(assignee => {\n-      sdk.log(`\\t\\t\\t${asignee.summary}`)\n+    incidentStr += `\\n\\t\\tPeople assigned:`\n+    incident.assignments.map(async assignee => {\n+      incidentStr += `\\n\\t\\t\\t${assignee.summary}`\n     })\n   }\n-  sdk.log(`\\t\\tLink: ${incident.html_url}`)\n+  incidentStr += `\\n\\t\\tLink: ${incident.html_url}\\n`\n+  return incidentStr\n }\n \n /**\n  * whoOnCall retrieves users on call with PagerDuty and prints them out\n  *\n  * @param {object} authData The user's entered auth data\n- * @param {object} user     The current SDK user\n  */\n-async function whoOnCall(authData, user) {\n+async function whoOnCall(authData) {\n   // Init our PD client\n   const { pagerDutyKey } = authData\n   pd.initializePagerDuty(pagerDutyKey)\n+  const { callOutCyan } = ux.colors\n \n   // Pretty print the on call users for each policy\n+  // Concatenated strings before printing for ux.print\n   const onCalls = await pd.getOnCall()\n-  Object.keys(onCalls).map(policy => {\n-    sdk.log(\n-      ux.colors.magenta(\n-        `The following people are on call for the '${policy}' policy:\\n\\n`\n-      )\n+  Object.keys(onCalls).forEach(async policy => {\n+    const policyTitle = ux.colors.magenta(","path":"integrations/pagerDuty.js","position":133,"original_position":133,"commit_id":"230ca8e3a8cde05a7e62d6f537fa24aaaa112f30","original_commit_id":"230ca8e3a8cde05a7e62d6f537fa24aaaa112f30","user":{"login":"CalHoll","id":21090765,"node_id":"MDQ6VXNlcjIxMDkwNzY1","avatar_url":"https://avatars3.githubusercontent.com/u/21090765?v=4","gravatar_id":"","url":"https://api.github.com/users/CalHoll","html_url":"https://github.com/CalHoll","followers_url":"https://api.github.com/users/CalHoll/followers","following_url":"https://api.github.com/users/CalHoll/following{/other_user}","gists_url":"https://api.github.com/users/CalHoll/gists{/gist_id}","starred_url":"https://api.github.com/users/CalHoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CalHoll/subscriptions","organizations_url":"https://api.github.com/users/CalHoll/orgs","repos_url":"https://api.github.com/users/CalHoll/repos","events_url":"https://api.github.com/users/CalHoll/events{/privacy}","received_events_url":"https://api.github.com/users/CalHoll/received_events","type":"User","site_admin":false},"body":"Also pull out all the colors at the top of the file <3","created_at":"2020-01-03T18:25:05Z","updated_at":"2020-01-03T18:25:05Z","html_url":"https://github.com/cto-ai/incident/pull/11#discussion_r362911081","pull_request_url":"https://api.github.com/repos/cto-ai/incident/pulls/11","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/comments/362911081"},"html":{"href":"https://github.com/cto-ai/incident/pull/11#discussion_r362911081"},"pull_request":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/11"}},"in_reply_to_id":362910941},"pull_request":{"url":"https://api.github.com/repos/cto-ai/incident/pulls/11","id":358782951,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU4NzgyOTUx","html_url":"https://github.com/cto-ai/incident/pull/11","diff_url":"https://github.com/cto-ai/incident/pull/11.diff","patch_url":"https://github.com/cto-ai/incident/pull/11.patch","issue_url":"https://api.github.com/repos/cto-ai/incident/issues/11","number":11,"state":"open","locked":false,"title":"WIP: Migration to sdk2. Fix up async output logging","user":{"login":"tw5033","id":16050851,"node_id":"MDQ6VXNlcjE2MDUwODUx","avatar_url":"https://avatars3.githubusercontent.com/u/16050851?v=4","gravatar_id":"","url":"https://api.github.com/users/tw5033","html_url":"https://github.com/tw5033","followers_url":"https://api.github.com/users/tw5033/followers","following_url":"https://api.github.com/users/tw5033/following{/other_user}","gists_url":"https://api.github.com/users/tw5033/gists{/gist_id}","starred_url":"https://api.github.com/users/tw5033/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tw5033/subscriptions","organizations_url":"https://api.github.com/users/tw5033/orgs","repos_url":"https://api.github.com/users/tw5033/repos","events_url":"https://api.github.com/users/tw5033/events{/privacy}","received_events_url":"https://api.github.com/users/tw5033/received_events","type":"User","site_admin":false},"body":"Migrates to use the latest release of the sdk. Includes UX/UI improvements and will close issues #1 #2 #6. \r\nChanges\r\n- List on-call output has reduced footprint for readability (No longer shows ID). Those who are on rotational on-call duty will have their end of shift displayed.\r\n- Searching incident output cleanup (capitalizing titles, increasing whitespace)\r\n- Place restrictions on date range on incident search","created_at":"2020-01-02T20:24:19Z","updated_at":"2020-01-03T18:25:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81875c878f9047b8c30bf4d2d5238c10955dfd09","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cto-ai/incident/pulls/11/commits","review_comments_url":"https://api.github.com/repos/cto-ai/incident/pulls/11/comments","review_comment_url":"https://api.github.com/repos/cto-ai/incident/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cto-ai/incident/issues/11/comments","statuses_url":"https://api.github.com/repos/cto-ai/incident/statuses/230ca8e3a8cde05a7e62d6f537fa24aaaa112f30","head":{"label":"cto-ai:ux-improvements","ref":"ux-improvements","sha":"230ca8e3a8cde05a7e62d6f537fa24aaaa112f30","user":{"login":"cto-ai","id":24818136,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODE4MTM2","avatar_url":"https://avatars1.githubusercontent.com/u/24818136?v=4","gravatar_id":"","url":"https://api.github.com/users/cto-ai","html_url":"https://github.com/cto-ai","followers_url":"https://api.github.com/users/cto-ai/followers","following_url":"https://api.github.com/users/cto-ai/following{/other_user}","gists_url":"https://api.github.com/users/cto-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/cto-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cto-ai/subscriptions","organizations_url":"https://api.github.com/users/cto-ai/orgs","repos_url":"https://api.github.com/users/cto-ai/repos","events_url":"https://api.github.com/users/cto-ai/events{/privacy}","received_events_url":"https://api.github.com/users/cto-ai/received_events","type":"Organization","site_admin":false},"repo":{"id":227232794,"node_id":"MDEwOlJlcG9zaXRvcnkyMjcyMzI3OTQ=","name":"incident","full_name":"cto-ai/incident","private":false,"owner":{"login":"cto-ai","id":24818136,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODE4MTM2","avatar_url":"https://avatars1.githubusercontent.com/u/24818136?v=4","gravatar_id":"","url":"https://api.github.com/users/cto-ai","html_url":"https://github.com/cto-ai","followers_url":"https://api.github.com/users/cto-ai/followers","following_url":"https://api.github.com/users/cto-ai/following{/other_user}","gists_url":"https://api.github.com/users/cto-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/cto-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cto-ai/subscriptions","organizations_url":"https://api.github.com/users/cto-ai/orgs","repos_url":"https://api.github.com/users/cto-ai/repos","events_url":"https://api.github.com/users/cto-ai/events{/privacy}","received_events_url":"https://api.github.com/users/cto-ai/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cto-ai/incident","description":"An Op to create and manage incidents.","fork":false,"url":"https://api.github.com/repos/cto-ai/incident","forks_url":"https://api.github.com/repos/cto-ai/incident/forks","keys_url":"https://api.github.com/repos/cto-ai/incident/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cto-ai/incident/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cto-ai/incident/teams","hooks_url":"https://api.github.com/repos/cto-ai/incident/hooks","issue_events_url":"https://api.github.com/repos/cto-ai/incident/issues/events{/number}","events_url":"https://api.github.com/repos/cto-ai/incident/events","assignees_url":"https://api.github.com/repos/cto-ai/incident/assignees{/user}","branches_url":"https://api.github.com/repos/cto-ai/incident/branches{/branch}","tags_url":"https://api.github.com/repos/cto-ai/incident/tags","blobs_url":"https://api.github.com/repos/cto-ai/incident/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cto-ai/incident/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cto-ai/incident/git/refs{/sha}","trees_url":"https://api.github.com/repos/cto-ai/incident/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cto-ai/incident/statuses/{sha}","languages_url":"https://api.github.com/repos/cto-ai/incident/languages","stargazers_url":"https://api.github.com/repos/cto-ai/incident/stargazers","contributors_url":"https://api.github.com/repos/cto-ai/incident/contributors","subscribers_url":"https://api.github.com/repos/cto-ai/incident/subscribers","subscription_url":"https://api.github.com/repos/cto-ai/incident/subscription","commits_url":"https://api.github.com/repos/cto-ai/incident/commits{/sha}","git_commits_url":"https://api.github.com/repos/cto-ai/incident/git/commits{/sha}","comments_url":"https://api.github.com/repos/cto-ai/incident/comments{/number}","issue_comment_url":"https://api.github.com/repos/cto-ai/incident/issues/comments{/number}","contents_url":"https://api.github.com/repos/cto-ai/incident/contents/{+path}","compare_url":"https://api.github.com/repos/cto-ai/incident/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cto-ai/incident/merges","archive_url":"https://api.github.com/repos/cto-ai/incident/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cto-ai/incident/downloads","issues_url":"https://api.github.com/repos/cto-ai/incident/issues{/number}","pulls_url":"https://api.github.com/repos/cto-ai/incident/pulls{/number}","milestones_url":"https://api.github.com/repos/cto-ai/incident/milestones{/number}","notifications_url":"https://api.github.com/repos/cto-ai/incident/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cto-ai/incident/labels{/name}","releases_url":"https://api.github.com/repos/cto-ai/incident/releases{/id}","deployments_url":"https://api.github.com/repos/cto-ai/incident/deployments","created_at":"2019-12-10T23:09:33Z","updated_at":"2020-01-02T20:30:15Z","pushed_at":"2020-01-03T00:40:19Z","git_url":"git://github.com/cto-ai/incident.git","ssh_url":"git@github.com:cto-ai/incident.git","clone_url":"https://github.com/cto-ai/incident.git","svn_url":"https://github.com/cto-ai/incident","homepage":"https://cto.ai","size":82,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":5,"watchers":2,"default_branch":"master"}},"base":{"label":"cto-ai:master","ref":"master","sha":"e1165f1589ad0a2a5c1fb9699b7c36cfab870743","user":{"login":"cto-ai","id":24818136,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODE4MTM2","avatar_url":"https://avatars1.githubusercontent.com/u/24818136?v=4","gravatar_id":"","url":"https://api.github.com/users/cto-ai","html_url":"https://github.com/cto-ai","followers_url":"https://api.github.com/users/cto-ai/followers","following_url":"https://api.github.com/users/cto-ai/following{/other_user}","gists_url":"https://api.github.com/users/cto-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/cto-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cto-ai/subscriptions","organizations_url":"https://api.github.com/users/cto-ai/orgs","repos_url":"https://api.github.com/users/cto-ai/repos","events_url":"https://api.github.com/users/cto-ai/events{/privacy}","received_events_url":"https://api.github.com/users/cto-ai/received_events","type":"Organization","site_admin":false},"repo":{"id":227232794,"node_id":"MDEwOlJlcG9zaXRvcnkyMjcyMzI3OTQ=","name":"incident","full_name":"cto-ai/incident","private":false,"owner":{"login":"cto-ai","id":24818136,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODE4MTM2","avatar_url":"https://avatars1.githubusercontent.com/u/24818136?v=4","gravatar_id":"","url":"https://api.github.com/users/cto-ai","html_url":"https://github.com/cto-ai","followers_url":"https://api.github.com/users/cto-ai/followers","following_url":"https://api.github.com/users/cto-ai/following{/other_user}","gists_url":"https://api.github.com/users/cto-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/cto-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cto-ai/subscriptions","organizations_url":"https://api.github.com/users/cto-ai/orgs","repos_url":"https://api.github.com/users/cto-ai/repos","events_url":"https://api.github.com/users/cto-ai/events{/privacy}","received_events_url":"https://api.github.com/users/cto-ai/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cto-ai/incident","description":"An Op to create and manage incidents.","fork":false,"url":"https://api.github.com/repos/cto-ai/incident","forks_url":"https://api.github.com/repos/cto-ai/incident/forks","keys_url":"https://api.github.com/repos/cto-ai/incident/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cto-ai/incident/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cto-ai/incident/teams","hooks_url":"https://api.github.com/repos/cto-ai/incident/hooks","issue_events_url":"https://api.github.com/repos/cto-ai/incident/issues/events{/number}","events_url":"https://api.github.com/repos/cto-ai/incident/events","assignees_url":"https://api.github.com/repos/cto-ai/incident/assignees{/user}","branches_url":"https://api.github.com/repos/cto-ai/incident/branches{/branch}","tags_url":"https://api.github.com/repos/cto-ai/incident/tags","blobs_url":"https://api.github.com/repos/cto-ai/incident/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cto-ai/incident/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cto-ai/incident/git/refs{/sha}","trees_url":"https://api.github.com/repos/cto-ai/incident/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cto-ai/incident/statuses/{sha}","languages_url":"https://api.github.com/repos/cto-ai/incident/languages","stargazers_url":"https://api.github.com/repos/cto-ai/incident/stargazers","contributors_url":"https://api.github.com/repos/cto-ai/incident/contributors","subscribers_url":"https://api.github.com/repos/cto-ai/incident/subscribers","subscription_url":"https://api.github.com/repos/cto-ai/incident/subscription","commits_url":"https://api.github.com/repos/cto-ai/incident/commits{/sha}","git_commits_url":"https://api.github.com/repos/cto-ai/incident/git/commits{/sha}","comments_url":"https://api.github.com/repos/cto-ai/incident/comments{/number}","issue_comment_url":"https://api.github.com/repos/cto-ai/incident/issues/comments{/number}","contents_url":"https://api.github.com/repos/cto-ai/incident/contents/{+path}","compare_url":"https://api.github.com/repos/cto-ai/incident/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cto-ai/incident/merges","archive_url":"https://api.github.com/repos/cto-ai/incident/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cto-ai/incident/downloads","issues_url":"https://api.github.com/repos/cto-ai/incident/issues{/number}","pulls_url":"https://api.github.com/repos/cto-ai/incident/pulls{/number}","milestones_url":"https://api.github.com/repos/cto-ai/incident/milestones{/number}","notifications_url":"https://api.github.com/repos/cto-ai/incident/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cto-ai/incident/labels{/name}","releases_url":"https://api.github.com/repos/cto-ai/incident/releases{/id}","deployments_url":"https://api.github.com/repos/cto-ai/incident/deployments","created_at":"2019-12-10T23:09:33Z","updated_at":"2020-01-02T20:30:15Z","pushed_at":"2020-01-03T00:40:19Z","git_url":"git://github.com/cto-ai/incident.git","ssh_url":"git@github.com:cto-ai/incident.git","clone_url":"https://github.com/cto-ai/incident.git","svn_url":"https://github.com/cto-ai/incident","homepage":"https://cto.ai","size":82,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/11"},"html":{"href":"https://github.com/cto-ai/incident/pull/11"},"issue":{"href":"https://api.github.com/repos/cto-ai/incident/issues/11"},"comments":{"href":"https://api.github.com/repos/cto-ai/incident/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cto-ai/incident/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/cto-ai/incident/statuses/230ca8e3a8cde05a7e62d6f537fa24aaaa112f30"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"CalHoll"}}