async function createPr()

in vsts/src/utils.ts [531:560]


async function createPr(
  title: string,
  base: string,
  head: string
): Promise<void> {
  // in azure pull request needs refs/heads/
  if (!head.startsWith('refs/heads/')) {
    head = 'refs/heads/' + head
  }
  if (!base.startsWith('refs/heads/')) {
    base = 'refs/heads/' + base
  }
  const description = prFixesBody(getWorkflowRunUrl())
  const gitApi = await getGitApi()
  const project = getVariable('System.TeamProject')
  const repoId = getVariable('Build.Repository.Id')
  const pr: GitInterfaces.GitPullRequest = {
    sourceRefName: head,
    targetRefName: base,
    title: title,
    description: description
  }
  try {
    await gitApi.createPullRequest(pr, repoId, project)
  } catch (error) {
    tl.warning(
      `Failed to create pull request ${head} -> ${base}: ${(error as Error).message}`
    )
  }
}