async function createGitlabIssue(token, projectId, summary) {
  await ux.spinner.start(`🏃  Creating GitLab Issue in Project ${projectId}`)
  const api = new Gitlab({
    host: 'https://git.cto.ai',
    token,
  })

  let description = `# Start Time \n ${summary.started_at} \n # Impact \n ${summary.impact} \n # Timeline \n`
  summary.timeline.map(timeline => {
    const ts = moment(timeline.ts)
      .tz(moment.tz.guess())
      .format('h:MM A z on dddd, MMMM D, YYYY')
    description = description.concat(
      `### ${timeline.status} : ${ts}\n - ${timeline.message}\n`
    )
  })

  try {
    const issue = await api.Issues.create(projectId, {
      title: summary.description,
      description,
      labels: 'incident.sh',
    })
    await ux.spinner.stop(
      `✅  Successfully created Gitlab Issue in Project ${projectId}!`
    )
    return issue.web_url
  } catch (err) {
    await ux.spinner.stop('😞  Unable to create GitLab issue!')
    await handleError(err, 'Could not create GitLab issue')
  }
}
/**
 * createGitlabIssue consolidates user info into a new GitLab issue.
 *
 * @param {string} token   The GitLab access token to use
 * @param {object} summary The Summary of the issue to create
 *
 * @return {string} The URL of the newly created issue
 */
createGitlabIssue consolidates user info into a new GitLab issue.
@param {string} token   The GitLab access token to use
@param {object} summary The Summary of the issue to create

@return {string} The URL of the newly created issue
createGitlabIssue consolidates user info into a new GitLab issue . @param { string } token The GitLab access token to use @param { object } summary The Summary of the issue to create @return { string } The URL of the newly created issue
async function createGitlabIssue(token, projectId, summary) {
  await ux.spinner.start(`🏃  Creating GitLab Issue in Project ${projectId}`)
  const api = new Gitlab({
    host: 'https://git.cto.ai',
    token,
  })
  let description = `# Start Time \n ${summary.started_at} \n # Impact \n ${summary.impact} \n # Timeline \n`
  summary.timeline.map(timeline => {
    const ts = moment(timeline.ts)
      .tz(moment.tz.guess())
      .format('h:MM A z on dddd, MMMM D, YYYY')
    description = description.concat(
      `### ${timeline.status} : ${ts}\n - ${timeline.message}\n`
    )
  })
  try {
    const issue = await api.Issues.create(projectId, {
      title: summary.description,
      description,
      labels: 'incident.sh',
    })
    await ux.spinner.stop(
      `✅  Successfully created Gitlab Issue in Project ${projectId}!`
    )
    return issue.web_url
  } catch (err) {
    await ux.spinner.stop('😞  Unable to create GitLab issue!')
    await handleError(err, 'Could not create GitLab issue')
  }
}
async function createGitlabIssue ( token , projectId , summary ) { await ux . spinner . start ( ` ro jectId}`) const api = new Gitlab ( { host : 'https://git.cto.ai' , token , } ) let description = ` \n ${ summary . started_at } \n \n ${ summary . impact } \n \n ` summary . timeline . map ( timeline => { const ts = moment ( timeline . ts ) . tz ( moment . tz . guess ( ) ) . format ( 'h:MM A z on dddd, MMMM D, YYYY' ) description = description . concat ( ` ${ timeline . status } ${ ts } \n ${ timeline . message } \n ` ) } ) try { const issue = await api . Issues . create ( projectId , { title : summary . description , description , labels : 'incident.sh' , } ) await ux . spinner . stop ( ` pr ojectId}! ` ) return issue . web_url } catch ( err ) { await ux . spinner . stop ( '😞  Unable to create GitLab issue!') await handleError ( err , 'Could not create GitLab issue' ) } }
createGitlabIssue consolidates user info into a new GitLab issue.
createGitlabIssue consolidates user info into a new GitLab issue .