function getParams()

in src/main.ts [30:75]


function getParams() {
  const inputCommitSha = getInput("commit-sha");
  const title = getInput("title");
  const emoji = getInput("emoji");
  const type = getInput("type");
  const published = getInput("published");
  const githubToken = getInput("github-token");

  const dryRun = toBoolean(getInput("dry-run"));
  if (dryRun === undefined) {
    throw new Error("dry-run is invalid");
  }

  const validateOnly = toBoolean(getInput("validate-only"));
  if (validateOnly === undefined) {
    throw new Error("validate-only is invalid");
  }

  const commitSha =
    inputCommitSha === "" ? process.env.GITHUB_SHA : inputCommitSha;
  if (!commitSha) {
    throw new Error("commit-sha is invalid");
  }

  const isForcePush = toBoolean(getInput("force-push"));
  if (isForcePush === undefined) {
    throw new Error("force-push is invalid");
  }

  const zennMetadata: Partial<ZennMetadata> = {
    title: title === "" ? undefined : title,
    emoji: emoji === "" ? undefined : emoji,
    type: type === "" ? undefined : (type as "idea" | "tech"),
    published: toBoolean(published),
  };

  const params: Readonly<Params> = {
    dryRun,
    zennMetadata,
    githubToken,
    commitSha,
    isForcePush,
    validateOnly,
  };
  return params;
}