Fix HTTP response stringify issue

This commit is contained in:
Luc Perkins 2024-05-20 09:25:51 -03:00
parent edc61c4d5a
commit a8b68ff5ba
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
3 changed files with 7 additions and 9 deletions

6
dist/index.js generated vendored
View file

@ -94996,15 +94996,13 @@ var MagicNixCacheAction = class {
try { try {
core.debug(`Indicating workflow start`); core.debug(`Indicating workflow start`);
const hostAndPort = inputs_exports.getString("listen"); const hostAndPort = inputs_exports.getString("listen");
const res = await this.client.post( const res = await this.client.post(`http://${hostAndPort}/api/workflow-start`).json();
`http://${hostAndPort}/api/workflow-start`
);
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
this.failInStrictMode( this.failInStrictMode(
`Failed to trigger workflow start hook. Expected status 200 but got ${res.statusCode}` `Failed to trigger workflow start hook. Expected status 200 but got ${res.statusCode}`
); );
} }
core.debug(`back from post: ${JSON.stringify(res)}`); core.debug(`back from post: ${JSON.stringify(res.body)}`);
} catch (e) { } catch (e) {
core.info(`Error marking the workflow as started:`); core.info(`Error marking the workflow as started:`);
core.info((0,external_node_util_.inspect)(e)); core.info((0,external_node_util_.inspect)(e));

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -274,9 +274,9 @@ class MagicNixCacheAction {
try { try {
actionsCore.debug(`Indicating workflow start`); actionsCore.debug(`Indicating workflow start`);
const hostAndPort = inputs.getString("listen"); const hostAndPort = inputs.getString("listen");
const res: Response<string> = await this.client.post( const res: Response<string> = await this.client
`http://${hostAndPort}/api/workflow-start`, .post(`http://${hostAndPort}/api/workflow-start`)
); .json();
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
this.failInStrictMode( this.failInStrictMode(
@ -284,7 +284,7 @@ class MagicNixCacheAction {
); );
} }
actionsCore.debug(`back from post: ${JSON.stringify(res)}`); actionsCore.debug(`back from post: ${JSON.stringify(res.body)}`);
} catch (e) { } catch (e) {
actionsCore.info(`Error marking the workflow as started:`); actionsCore.info(`Error marking the workflow as started:`);
actionsCore.info(inspect(e)); actionsCore.info(inspect(e));