Reworkeed the function to use Promice resolve
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
This commit is contained in:
parent
ddd15b4063
commit
dd929af281
24
index.js
24
index.js
@ -114,14 +114,26 @@ async function postCode() {
|
||||
let api;
|
||||
if (token) {
|
||||
api = new ScreepsAPI(login_arguments);
|
||||
} else {
|
||||
core.info(`Logging into as user ${username}`);
|
||||
api = new ScreepsAPI(login_arguments);
|
||||
await api.auth(username, password);
|
||||
core.info("Authorized!");
|
||||
}
|
||||
const response = await api.code.set(branch, files_to_push);
|
||||
core.info(JSON.stringify(response, null, 2));
|
||||
} else {
|
||||
core.info(`Logging into as user ${username}`);
|
||||
const response = Promise.resolve()
|
||||
.then(() => api.auth(auth.email, auth.password))
|
||||
.then(() => api.socket.connect())
|
||||
.then(() => {
|
||||
return api.code.set(branch, code); // Set the code on the specified branch
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Code set successfully");
|
||||
// Additional actions after setting the code, if necessary
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Error:", err);
|
||||
});
|
||||
core.info("Authorized!");
|
||||
core.info(JSON.stringify(response, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
postCode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user