async function postStatusToGitHub(options) {
  const {
    slug,
    hash,
    state,
    targetUrl,
    context,
    description,
    githubToken,
    githubAppToken,
    githubApiHost = DEFAULT_GITHUB_API_HOST,
    githubAppUrl = GITHUB_APP_STATUS_CHECK_URL,
  } = options;

  let response;
  if (githubAppToken) {
    const payload = {...options, token: githubAppToken};
    response = await fetch(githubAppUrl, {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify(payload),
    });
  } else {
    const url = `${githubApiHost}/repos/${slug}/statuses/${hash}`;
    const payload = {state, context, description, target_url: targetUrl};
    response = await fetch(url, {
      method: 'POST',
      headers: {'Content-Type': 'application/json', Authorization: `token ${githubToken}`},
      body: JSON.stringify(payload),
    });
  }

  if (response.status === 201) {
    print(`GitHub accepted "${state}" status for "${context}".\n`);
  } else {
    print(`GitHub responded with ${response.status}\n${await response.text()}\n\n`);
  }
}
@param {{slug: string, hash: string, state: 'failure'|'success', targetUrl: string, description: string, context: string, githubToken?: string, githubAppToken?: string, githubApiHost?: string, githubAppUrl?: string}} options