scripts/check-run.js
async function execAndReport({ cmd, name }) {
  try {
    const {
      failed,
      // code,
      // timedOut,
      stdout,
      stderr,
      // message,
    } = await execa.shell(cmd);
    process.stdout.write(stdout);
    process.stderr.write(stderr);
    await setCheckRun({
      name,
      status: 'completed',
      conclusion: 'success',
      output: {
        title: name,
        summary: `Ran ${cmd}`,
      },
    });
    return failed;
  } catch (err) {
    const {
      failed,
      // code,
      // timedOut,
      stdout,
      stderr,
      message,
    } = err;
    process.stdout.write(stdout);
    process.stderr.write(stderr);
    await setCheckRun({
      name,
      status: 'completed',
      conclusion: 'failure',
      output: {
        title: name,
        summary: `Ran ${cmd}`,
        text: `
<pre><code>
${message}
</code></pre>
        `.trim(),
      },
    });

    return failed;
  }
}
async function execAndReport({ cmd, name }) {
  try {
    const {
      failed,
      // code,
      // timedOut,
      stdout,
      stderr,
      // message,
    } = await execa.shell(cmd);
    process.stdout.write(stdout);
    process.stderr.write(stderr);
    await setCheckRun({
      name,
      status: 'completed',
      conclusion: 'success',
      output: {
        title: name,
        summary: `Ran ${cmd}`,
      },
    });
    return failed;
  } catch (err) {
    const {
      failed,
      // code,
      // timedOut,
      stdout,
      stderr,
      message,
    } = err;
    process.stdout.write(stdout);
    process.stderr.write(stderr);
    await setCheckRun({
      name,
      status: 'completed',
      conclusion: 'failure',
      output: {
        title: name,
        summary: `Ran ${cmd}`,
        text: `
<pre><code>
${message}
</code></pre>
        `.trim(),
      },
    });

    return failed;
  }
}
async function execAndReport ( { cmd , name } ) { try { const { failed , // code, // timedOut, stdout , stderr , // message, } = await execa . shell ( cmd ) ; process . stdout . write ( stdout ) ; process . stderr . write ( stderr ) ; await setCheckRun ( { name , status : 'completed' , conclusion : 'success' , output : { title : name , summary : ` ${ cmd } ` , } , } ) ; return failed ; } catch ( err ) { const { failed , // code, // timedOut, stdout , stderr , message , } = err ; process . stdout . write ( stdout ) ; process . stderr . write ( stderr ) ; await setCheckRun ( { name , status : 'completed' , conclusion : 'failure' , output : { title : name , summary : ` ${ cmd } ` , text : ` ${ message } ` . trim ( ) , } , } ) ; return failed ; } }
Exec Shell Command and Report Results to GitHub Checks
@param {Object} opt
@param {string} opt.cmd - Shell command to execute from CWD
@param {string} opt.name - GitHub Checks Name
@return {Promise<boolean>} Did cmd fail?
Exec Shell Command and Report Results to GitHub Checks