Skip to content

Commit 528fb3f

Browse files
committed
🔊 Add some logging for the current status
1 parent 61b816e commit 528fb3f

File tree

2 files changed

+51
-38
lines changed

2 files changed

+51
-38
lines changed

‎dist/action.js‎

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17627,12 +17627,12 @@ var require_lib = __commonJS({
1762717627
throw new Error("Client has already been disposed.");
1762817628
}
1762917629
const parsedUrl = new URL(requestUrl);
17630-
let info = this._prepareRequest(verb, parsedUrl, headers);
17630+
let info2 = this._prepareRequest(verb, parsedUrl, headers);
1763117631
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1;
1763217632
let numTries = 0;
1763317633
let response;
1763417634
do {
17635-
response = yield this.requestRaw(info, data);
17635+
response = yield this.requestRaw(info2, data);
1763617636
if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {
1763717637
let authenticationHandler;
1763817638
for (const handler of this.handlers) {
@@ -17642,7 +17642,7 @@ var require_lib = __commonJS({
1764217642
}
1764317643
}
1764417644
if (authenticationHandler) {
17645-
return authenticationHandler.handleAuthentication(this, info, data);
17645+
return authenticationHandler.handleAuthentication(this, info2, data);
1764617646
} else {
1764717647
return response;
1764817648
}
@@ -17665,8 +17665,8 @@ var require_lib = __commonJS({
1766517665
}
1766617666
}
1766717667
}
17668-
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
17669-
response = yield this.requestRaw(info, data);
17668+
info2 = this._prepareRequest(verb, parsedRedirectUrl, headers);
17669+
response = yield this.requestRaw(info2, data);
1767017670
redirectsRemaining--;
1767117671
}
1767217672
if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) {
@@ -17695,7 +17695,7 @@ var require_lib = __commonJS({
1769517695
* @param info
1769617696
* @param data
1769717697
*/
17698-
requestRaw(info, data) {
17698+
requestRaw(info2, data) {
1769917699
return __awaiter(this, void 0, void 0, function* () {
1770017700
return new Promise((resolve, reject) => {
1770117701
function callbackForResult(err, res) {
@@ -17707,7 +17707,7 @@ var require_lib = __commonJS({
1770717707
resolve(res);
1770817708
}
1770917709
}
17710-
this.requestRawWithCallback(info, data, callbackForResult);
17710+
this.requestRawWithCallback(info2, data, callbackForResult);
1771117711
});
1771217712
});
1771317713
}
@@ -17717,12 +17717,12 @@ var require_lib = __commonJS({
1771717717
* @param data
1771817718
* @param onResult
1771917719
*/
17720-
requestRawWithCallback(info, data, onResult) {
17720+
requestRawWithCallback(info2, data, onResult) {
1772117721
if (typeof data === "string") {
17722-
if (!info.options.headers) {
17723-
info.options.headers = {};
17722+
if (!info2.options.headers) {
17723+
info2.options.headers = {};
1772417724
}
17725-
info.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8");
17725+
info2.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8");
1772617726
}
1772717727
let callbackCalled = false;
1772817728
function handleResult(err, res) {
@@ -17731,7 +17731,7 @@ var require_lib = __commonJS({
1773117731
onResult(err, res);
1773217732
}
1773317733
}
17734-
const req = info.httpModule.request(info.options, (msg) => {
17734+
const req = info2.httpModule.request(info2.options, (msg) => {
1773517735
const res = new HttpClientResponse(msg);
1773617736
handleResult(void 0, res);
1773717737
});
@@ -17743,7 +17743,7 @@ var require_lib = __commonJS({
1774317743
if (socket) {
1774417744
socket.end();
1774517745
}
17746-
handleResult(new Error(`Request timeout: ${info.options.path}`));
17746+
handleResult(new Error(`Request timeout: ${info2.options.path}`));
1774717747
});
1774817748
req.on("error", function(err) {
1774917749
handleResult(err);
@@ -17779,27 +17779,27 @@ var require_lib = __commonJS({
1777917779
return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
1778017780
}
1778117781
_prepareRequest(method, requestUrl, headers) {
17782-
const info = {};
17783-
info.parsedUrl = requestUrl;
17784-
const usingSsl = info.parsedUrl.protocol === "https:";
17785-
info.httpModule = usingSsl ? https : http;
17782+
const info2 = {};
17783+
info2.parsedUrl = requestUrl;
17784+
const usingSsl = info2.parsedUrl.protocol === "https:";
17785+
info2.httpModule = usingSsl ? https : http;
1778617786
const defaultPort = usingSsl ? 443 : 80;
17787-
info.options = {};
17788-
info.options.host = info.parsedUrl.hostname;
17789-
info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort;
17790-
info.options.path = (info.parsedUrl.pathname || "") + (info.parsedUrl.search || "");
17791-
info.options.method = method;
17792-
info.options.headers = this._mergeHeaders(headers);
17787+
info2.options = {};
17788+
info2.options.host = info2.parsedUrl.hostname;
17789+
info2.options.port = info2.parsedUrl.port ? parseInt(info2.parsedUrl.port) : defaultPort;
17790+
info2.options.path = (info2.parsedUrl.pathname || "") + (info2.parsedUrl.search || "");
17791+
info2.options.method = method;
17792+
info2.options.headers = this._mergeHeaders(headers);
1779317793
if (this.userAgent != null) {
17794-
info.options.headers["user-agent"] = this.userAgent;
17794+
info2.options.headers["user-agent"] = this.userAgent;
1779517795
}
17796-
info.options.agent = this._getAgent(info.parsedUrl);
17796+
info2.options.agent = this._getAgent(info2.parsedUrl);
1779717797
if (this.handlers) {
1779817798
for (const handler of this.handlers) {
17799-
handler.prepareRequest(info.options);
17799+
handler.prepareRequest(info2.options);
1780017800
}
1780117801
}
17802-
return info;
17802+
return info2;
1780317803
}
1780417804
_mergeHeaders(headers) {
1780517805
if (this.requestOptions && this.requestOptions.headers) {
@@ -19789,10 +19789,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
1978919789
(0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
1979019790
}
1979119791
exports2.notice = notice;
19792-
function info(message) {
19792+
function info2(message) {
1979319793
process.stdout.write(message + os.EOL);
1979419794
}
19795-
exports2.info = info;
19795+
exports2.info = info2;
1979619796
function startGroup(name) {
1979719797
(0, command_1.issue)("group", name);
1979819798
}
@@ -19924,7 +19924,7 @@ void (async () => {
1992419924
(deployment) => deployment.deployment_uuid
1992519925
);
1992619926
const status = Object.fromEntries(
19927-
deploymentUUIDs.map((uuid2) => [uuid2, "pending"])
19927+
deploymentUUIDs.map((uuid2) => [uuid2, "queued"])
1992819928
);
1992919929
const endTime = Date.now() + waitTimeSeconds * 1e3;
1993019930
const pause = 5e3;
@@ -19934,10 +19934,16 @@ void (async () => {
1993419934
process.exit(1);
1993519935
}
1993619936
for (const uuid2 of deploymentUUIDs.filter(
19937-
(uuid3) => status[uuid3] !== "finished"
19937+
(uuid3) => status[uuid3] !== "finished" && status[uuid3] !== "failed"
1993819938
)) {
19939-
status[uuid2] = await getDeploymentStatus(uuid2);
19940-
(0, import_core.debug)(`Deployment ${uuid2} status: ${status[uuid2]}`);
19939+
const nextStatus = await getDeploymentStatus(uuid2);
19940+
if (nextStatus !== status[uuid2]) {
19941+
(0, import_core.info)(`Deployment ${uuid2} status: ${nextStatus}`);
19942+
status[uuid2] = nextStatus;
19943+
}
19944+
if (status[uuid2] === "failed") {
19945+
(0, import_core.setFailed)(`Deployment ${uuid2} failed`);
19946+
}
1994119947
}
1994219948
await new Promise((resolve) => setTimeout(resolve, pause));
1994319949
}

‎src/action.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debug, getInput, setFailed } from "@actions/core";
1+
import { debug, getInput, info, setFailed } from "@actions/core";
22

33
const waitTimeSeconds = Number.parseInt(getInput("wait", { required: false }));
44
const apiKey = getInput("api-key", { required: true });
@@ -96,7 +96,7 @@ void (async () => {
9696
);
9797

9898
const status = Object.fromEntries(
99-
deploymentUUIDs.map((uuid) => [uuid, "pending"]),
99+
deploymentUUIDs.map((uuid) => [uuid, "queued"]),
100100
);
101101
const endTime = Date.now() + waitTimeSeconds * 1000;
102102
// Pause between attempts
@@ -109,10 +109,17 @@ void (async () => {
109109
}
110110

111111
for (const uuid of deploymentUUIDs.filter(
112-
(uuid) => status[uuid] !== "finished",
112+
(uuid) => status[uuid] !== "finished" && status[uuid] !== "failed",
113113
)) {
114-
status[uuid] = await getDeploymentStatus(uuid);
115-
debug(`Deployment ${uuid} status: ${status[uuid]}`);
114+
const nextStatus = await getDeploymentStatus(uuid);
115+
if (nextStatus !== status[uuid]) {
116+
info(`Deployment ${uuid} status: ${nextStatus}`);
117+
status[uuid] = nextStatus;
118+
}
119+
120+
if (status[uuid] === "failed") {
121+
setFailed(`Deployment ${uuid} failed`);
122+
}
116123
}
117124

118125
await new Promise((resolve) => setTimeout(resolve, pause));

0 commit comments

Comments
 (0)