@jsenv/github-check-run 0.0.12 → 0.0.13
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
|
@@ -74,6 +74,8 @@ export const startGithubCheckRun = async ({
|
|
|
74
74
|
return { progress: () => {}, fail: () => {}, pass: () => {} };
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
let checkConclusion;
|
|
78
|
+
|
|
77
79
|
const update = async ({
|
|
78
80
|
status,
|
|
79
81
|
conclusion,
|
|
@@ -87,6 +89,9 @@ export const startGithubCheckRun = async ({
|
|
|
87
89
|
if (typeof summary !== "string") {
|
|
88
90
|
throw new TypeError(`summary must be a string, got ${summary}`);
|
|
89
91
|
}
|
|
92
|
+
if (conclusion) {
|
|
93
|
+
checkConclusion = conclusion;
|
|
94
|
+
}
|
|
90
95
|
|
|
91
96
|
let annotationsSent = 0;
|
|
92
97
|
const annotationsBatch = annotations.slice(annotationsSent, 50);
|
|
@@ -152,6 +157,12 @@ ${JSON.stringify(body, null, " ")}`);
|
|
|
152
157
|
|
|
153
158
|
return {
|
|
154
159
|
progress: async ({ title, summary, annotations = [] }) => {
|
|
160
|
+
if (checkConclusion === "failure") {
|
|
161
|
+
throw new Error(`cannot progress() after fail()`);
|
|
162
|
+
}
|
|
163
|
+
if (checkConclusion === "success") {
|
|
164
|
+
throw new Error(`cannot progress() after pass()`);
|
|
165
|
+
}
|
|
155
166
|
const nowMs = Date.now();
|
|
156
167
|
const isFirstCall = !lastProgressCall;
|
|
157
168
|
lastProgressCall = nowMs;
|
|
@@ -196,10 +207,11 @@ ${JSON.stringify(body, null, " ")}`);
|
|
|
196
207
|
});
|
|
197
208
|
},
|
|
198
209
|
fail: ({ title, summary, annotations } = {}) => {
|
|
199
|
-
if (
|
|
200
|
-
throw new Error(
|
|
201
|
-
|
|
202
|
-
|
|
210
|
+
if (checkConclusion === "failure") {
|
|
211
|
+
throw new Error(`already failed`);
|
|
212
|
+
}
|
|
213
|
+
if (checkConclusion === "success") {
|
|
214
|
+
throw new Error(`cannot fail() after pass()`);
|
|
203
215
|
}
|
|
204
216
|
|
|
205
217
|
if (pendingAbortController) {
|
|
@@ -215,11 +227,13 @@ ${JSON.stringify(body, null, " ")}`);
|
|
|
215
227
|
});
|
|
216
228
|
},
|
|
217
229
|
pass: ({ title, summary, annotations } = {}) => {
|
|
218
|
-
if (
|
|
219
|
-
throw new Error(
|
|
220
|
-
|
|
221
|
-
|
|
230
|
+
if (checkConclusion === "success") {
|
|
231
|
+
throw new Error(`already passed`);
|
|
232
|
+
}
|
|
233
|
+
if (checkConclusion === "failure") {
|
|
234
|
+
throw new Error(`cannot pass() after fail()`);
|
|
222
235
|
}
|
|
236
|
+
|
|
223
237
|
if (pendingAbortController) {
|
|
224
238
|
pendingAbortController.abort();
|
|
225
239
|
}
|