@jsenv/github-check-run 0.0.10 → 0.0.12

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.10",
3
+ "version": "0.0.12",
4
4
  "description": "Interact with GitHub check rest API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -196,6 +196,16 @@ ${JSON.stringify(body, null, " ")}`);
196
196
  });
197
197
  },
198
198
  fail: ({ title, summary, annotations } = {}) => {
199
+ if (checkStatus !== "in_progress") {
200
+ throw new Error(
201
+ `fail() must be called while checkStatus is "in_progress", got ${checkStatus}`,
202
+ );
203
+ }
204
+
205
+ if (pendingAbortController) {
206
+ pendingAbortController.abort();
207
+ }
208
+ // TODO: wait to any update before PATCH
199
209
  return update({
200
210
  status: "completed",
201
211
  conclusion: "failure",
@@ -205,6 +215,15 @@ ${JSON.stringify(body, null, " ")}`);
205
215
  });
206
216
  },
207
217
  pass: ({ title, summary, annotations } = {}) => {
218
+ if (checkStatus !== "in_progress") {
219
+ throw new Error(
220
+ `pass() must be called while checkStatus is "in_progress", got ${checkStatus}`,
221
+ );
222
+ }
223
+ if (pendingAbortController) {
224
+ pendingAbortController.abort();
225
+ }
226
+ // TODO: wait to any pending update before PATCH
208
227
  return update({
209
228
  status: "completed",
210
229
  conclusion: "success",