diff --git a/dist/main.cjs b/dist/main.cjs index 42b48da..266e78e 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -2811,8 +2811,18 @@ var require_dist_node5 = __commonJS({ module2.exports = __toCommonJS2(dist_src_exports); var import_endpoint = require_dist_node2(); var import_universal_user_agent = require_dist_node(); - var VERSION = "8.1.4"; - var import_is_plain_object = require_is_plain_object(); + var VERSION = "8.1.6"; + function isPlainObject(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); + } var import_request_error = require_dist_node4(); function getBufferResponse(response) { return response.arrayBuffer(); @@ -2821,7 +2831,7 @@ var require_dist_node5 = __commonJS({ var _a, _b, _c; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -2927,7 +2937,7 @@ var require_dist_node5 = __commonJS({ async function getResponseData(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { - return response.json(); + return response.json().catch(() => response.text()).catch(() => ""); } if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { return response.text(); diff --git a/dist/post.cjs b/dist/post.cjs index 6576ea6..6e50d70 100644 --- a/dist/post.cjs +++ b/dist/post.cjs @@ -2811,8 +2811,18 @@ var require_dist_node5 = __commonJS({ module2.exports = __toCommonJS2(dist_src_exports); var import_endpoint = require_dist_node2(); var import_universal_user_agent = require_dist_node(); - var VERSION = "8.1.4"; - var import_is_plain_object = require_is_plain_object(); + var VERSION = "8.1.6"; + function isPlainObject(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); + } var import_request_error = require_dist_node4(); function getBufferResponse(response) { return response.arrayBuffer(); @@ -2821,7 +2831,7 @@ var require_dist_node5 = __commonJS({ var _a, _b, _c; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -2927,7 +2937,7 @@ var require_dist_node5 = __commonJS({ async function getResponseData(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { - return response.json(); + return response.json().catch(() => response.text()).catch(() => ""); } if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { return response.text(); diff --git a/package.json b/package.json index 3651860..e3b0b3f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "create-github-app-token", "private": true, "type": "module", - "version": "1.6.0", + "version": "1.6.1", "description": "GitHub Action for creating a GitHub App Installation Access Token", "scripts": { "build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node20.0.0",