Fail when workflow finish hook fails

This commit is contained in:
Luc Perkins 2024-05-20 07:57:19 -03:00
parent 79ca9d8642
commit aa46387b46
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
3 changed files with 13 additions and 1 deletions

5
dist/index.js generated vendored
View file

@ -95023,6 +95023,11 @@ var MagicNixCacheAction = class {
core.debug(`about to post to localhost`); core.debug(`about to post to localhost`);
const hostAndPort = inputs_exports.getString("listen"); const hostAndPort = inputs_exports.getString("listen");
const res = await this.client.post(`http://${hostAndPort}/api/workflow-finish`).json(); const res = await this.client.post(`http://${hostAndPort}/api/workflow-finish`).json();
if (res.status !== 200) {
this.failInStrictMode(
`Failed to trigger workflow finish hook; expected HTTP status 200 from POST to /api/workflow-finish but got ${res.status} instead`
);
}
core.debug(`back from post: ${res}`); core.debug(`back from post: ${res}`);
} finally { } finally {
core.debug(`unwatching the daemon log`); core.debug(`unwatching the daemon log`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -310,6 +310,13 @@ class MagicNixCacheAction {
const res: Response = await this.client const res: Response = await this.client
.post(`http://${hostAndPort}/api/workflow-finish`) .post(`http://${hostAndPort}/api/workflow-finish`)
.json(); .json();
if (res.status !== 200) {
this.failInStrictMode(
`Failed to trigger workflow finish hook; expected HTTP status 200 from POST to /api/workflow-finish but got ${res.status} instead`,
);
}
actionsCore.debug(`back from post: ${res}`); actionsCore.debug(`back from post: ${res}`);
} finally { } finally {
actionsCore.debug(`unwatching the daemon log`); actionsCore.debug(`unwatching the daemon log`);