async function run() {
  try {
    const githubToken = core.getInput("github_token");
    const checkName = core.getInput("check_name");
    const reportPath = core.getInput("report_path");
    const reportFilename = core.getInput("report_filename");
    const useWorkflowCommands = core.getInput("use_workflow_commands");

    let fullPath;
    if (reportFilename) {
      fullPath = `${reportPath}${reportFilename}`;
    } else {
      fullPath = await mergeReports(reportPath);
    }
    const failingCases = await failingCasesFrom(fullPath);
    core.info(`${failingCases.length} failures found`);
    if (failingCases.length) {
      const pullRequest = github.context.payload.pull_request;
      const head_sha =
        (pullRequest && pullRequest.head.sha) || github.context.sha;
      const annotations = annotationsFrom(failingCases);

      if (useWorkflowCommands) {
        core.info(`Adding annotations with Workflow commands`);
        // https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
        annotations.map(
          ({ path, start_line, end_line, annotation_level, message }) => {
            command.issueCommand(
              "error", // or warning
              { file: path, line: start_line, col: 0 },
              message
            );
          }
        );
      } else {
        core.info(`Adding annotations with GitHub Checks API`);
        await createCheckAnnotations(
          githubToken,
          checkName,
          head_sha,
          annotations
        );
      }
    }
  } catch (error) {
    core.setFailed(error.message);
  }
}
// most @actions toolkit packages have async methods
most @actions toolkit packages have async methods
most @actions toolkit packages have async methods
async function run() {
  try {
    const githubToken = core.getInput("github_token");
    const checkName = core.getInput("check_name");
    const reportPath = core.getInput("report_path");
    const reportFilename = core.getInput("report_filename");
    const useWorkflowCommands = core.getInput("use_workflow_commands");
    let fullPath;
    if (reportFilename) {
      fullPath = `${reportPath}${reportFilename}`;
    } else {
      fullPath = await mergeReports(reportPath);
    }
    const failingCases = await failingCasesFrom(fullPath);
    core.info(`${failingCases.length} failures found`);
    if (failingCases.length) {
      const pullRequest = github.context.payload.pull_request;
      const head_sha =
        (pullRequest && pullRequest.head.sha) || github.context.sha;
      const annotations = annotationsFrom(failingCases);
      if (useWorkflowCommands) {
        core.info(`Adding annotations with Workflow commands`);
        annotations.map(
          ({ path, start_line, end_line, annotation_level, message }) => {
            command.issueCommand(
              "error", 
              { file: path, line: start_line, col: 0 },
              message
            );
          }
        );
      } else {
        core.info(`Adding annotations with GitHub Checks API`);
        await createCheckAnnotations(
          githubToken,
          checkName,
          head_sha,
          annotations
        );
      }
    }
  } catch (error) {
    core.setFailed(error.message);
  }
}
async function run ( ) { try { const githubToken = core . getInput ( "github_token" ) ; const checkName = core . getInput ( "check_name" ) ; const reportPath = core . getInput ( "report_path" ) ; const reportFilename = core . getInput ( "report_filename" ) ; const useWorkflowCommands = core . getInput ( "use_workflow_commands" ) ; let fullPath ; if ( reportFilename ) { fullPath = ` ${ reportPath } ${ reportFilename } ` ; } else { fullPath = await mergeReports ( reportPath ) ; } const failingCases = await failingCasesFrom ( fullPath ) ; core . info ( ` ${ failingCases . length } ` ) ; if ( failingCases . length ) { const pullRequest = github . context . payload . pull_request ; const head_sha = ( pullRequest && pullRequest . head . sha ) || github . context . sha ; const annotations = annotationsFrom ( failingCases ) ; if ( useWorkflowCommands ) { core . info ( ` ` ) ; annotations . map ( ( { path , start_line , end_line , annotation_level , message } ) => { command . issueCommand ( "error" , { file : path , line : start_line , col : 0 } , message ) ; } ) ; } else { core . info ( ` ` ) ; await createCheckAnnotations ( githubToken , checkName , head_sha , annotations ) ; } } } catch ( error ) { core . setFailed ( error . message ) ; } }
most @actions toolkit packages have async methods
most @actions toolkit packages have async methods
// https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions // or warning