@jsenv/github-check-run 0.0.11 → 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.11",
3
+ "version": "0.0.12",
4
4
  "description": "Interact with GitHub check rest API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -196,9 +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
+
199
205
  if (pendingAbortController) {
200
206
  pendingAbortController.abort();
201
207
  }
208
+ // TODO: wait to any update before PATCH
202
209
  return update({
203
210
  status: "completed",
204
211
  conclusion: "failure",
@@ -208,9 +215,15 @@ ${JSON.stringify(body, null, " ")}`);
208
215
  });
209
216
  },
210
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
+ }
211
223
  if (pendingAbortController) {
212
224
  pendingAbortController.abort();
213
225
  }
226
+ // TODO: wait to any pending update before PATCH
214
227
  return update({
215
228
  status: "completed",
216
229
  conclusion: "success",