@jsenv/github-check-run 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/github-check-run",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Interact with GitHub check rest API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -81,23 +81,33 @@ export const startGithubCheckRun = async ({
81
81
  summary,
82
82
  annotations = [],
83
83
  }) => {
84
+ if (typeof title !== "string") {
85
+ throw new TypeError(`title must be a string, got ${title}`);
86
+ }
87
+ if (typeof summary !== "string") {
88
+ throw new TypeError(`summary must be a string, got ${summary}`);
89
+ }
90
+
84
91
  let annotationsSent = 0;
85
92
  const annotationsBatch = annotations.slice(annotationsSent, 50);
86
- logger.debug(`update check run ${check.id}`);
93
+
87
94
  try {
95
+ const body = {
96
+ ...(status ? { status } : {}),
97
+ ...(conclusion ? { conclusion } : {}),
98
+ output: {
99
+ title,
100
+ summary,
101
+ ...(annotationsBatch.length ? { annotations: annotationsBatch } : {}),
102
+ },
103
+ };
104
+ logger.debug(`PATCH check ${check.html_url}
105
+ --- body ---
106
+ ${JSON.stringify(body, null, " ")}`);
88
107
  await PATCH({
89
108
  url: check.url,
90
109
  githubToken,
91
- body: {
92
- head_sha: commitSha,
93
- ...(status ? { status } : {}),
94
- ...(conclusion ? { conclusion } : {}),
95
- output: {
96
- ...(title ? { title } : {}),
97
- ...(summary ? { summary } : {}),
98
- annotations: annotationsBatch,
99
- },
100
- },
110
+ body,
101
111
  });
102
112
  logger.debug(`${UNICODE.OK} check updated`);
103
113
  } catch (e) {