0.1.10 • Published 4 months ago

@jsenv/github-check-run v0.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

GitHub check run npm package

import { startGithubCheckRun } from "@jsenv/github-check-run";

const values = [1_000, 2_000, 4_000];

const githubCheck = await startGithubCheckRun({
  githubToken: "",
  repositoryOwner: "dmail",
  repositoryName: "repo-name",
  commitSha: "",
  checkName: "demo",
  checkTitle: "Running demo",
  checkSummary: `preparing execution of ${values.length} timeouts`,
});

try {
  let index = 0;
  for (const value of values) {
    githubCheck.progress({
      summary: `executing timeout ${index + 1}/${values.length}`,
    });
    await new Promise((resolve) => {
      setTimeout(resolve, value);
    });
    index++;
  }
  await githubCheck.pass({
    summary: `${values.length} timeout execution done`,
  });
} catch (e) {
  await githubCheck.fail({
    summary: `error while executing timeout number ${index + 1}: ${e.stack}`,
  });
}

If the code is executed inside a Github workflow, several parameters can be retrieved using readGitHubWorkflowEnv:

import {
  startGithubCheckRun,
  readGitHubWorkflowEnv,
} from "@jsenv/github-check-run";

const githubCheck = await startGithubCheckRun({
  ...readGitHubWorkflowEnv(),
  checkName: "demo",
  checkTitle: "Running demo",
  checkSummary: `Executing ${values.length} setTimeouts`,
});
0.1.10

4 months ago

0.1.8

4 months ago

0.1.9

4 months ago

0.1.7

4 months ago

0.1.6

6 months ago

0.1.5

6 months ago

0.1.4

6 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

8 months ago

0.0.13

8 months ago

0.0.12

8 months ago

0.0.11

8 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago