0.2.1 • Published 10 months ago

@jsenv/github-check-run v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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.11

12 months ago

0.1.12

12 months ago

0.1.13

12 months ago

0.1.14

12 months ago

0.1.15

12 months ago

0.1.30

11 months ago

0.1.31

11 months ago

0.1.32

10 months ago

0.1.27

11 months ago

0.1.28

11 months ago

0.1.29

11 months ago

0.1.20

11 months ago

0.1.21

11 months ago

0.1.22

11 months ago

0.1.23

11 months ago

0.1.24

11 months ago

0.1.25

11 months ago

0.1.26

11 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.16

12 months ago

0.1.17

11 months ago

0.1.18

11 months ago

0.1.19

11 months ago

0.1.10

1 year ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.7

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago