Compare commits
19 Commits
main
...
7933a62f3a
Author | SHA1 | Date | |
---|---|---|---|
7933a62f3a
|
|||
2e271692b0
|
|||
ad5a6efa14
|
|||
b0725e8219
|
|||
7b50736f64
|
|||
a114309427
|
|||
8c4feac99a
|
|||
d9aa117ac6
|
|||
dbd765cbdf
|
|||
c69726c600
|
|||
14f1218845
|
|||
368ba86559
|
|||
dd929af281
|
|||
ddd15b4063
|
|||
a312781dc7
|
|||
7f5df4a59e
|
|||
9be17fd1a0
|
|||
bc56766110
|
|||
0537c5a914
|
40
index.js
40
index.js
@ -90,36 +90,52 @@ async function postCode() {
|
||||
|
||||
const files_to_push = await readFilesIntoDict(pattern, prefix);
|
||||
|
||||
core.info(`Trying to upload the following files to ${branch}:`);
|
||||
Object.keys(files_to_push).forEach((key) => {
|
||||
core.info(`Key: ${key}`);
|
||||
});
|
||||
|
||||
core.info(files_to_push);
|
||||
|
||||
const login_arguments = {
|
||||
token: token,
|
||||
username: username,
|
||||
password: password,
|
||||
protocol: protocol,
|
||||
hostname: hostname,
|
||||
port: port,
|
||||
path: path,
|
||||
username: "NameVergessen",
|
||||
password: password,
|
||||
};
|
||||
|
||||
core.info(`Trying to upload the following files to ${branch}:`);
|
||||
Object.keys(login_arguments).forEach((key) => {
|
||||
core.info(`Key: ${key}`);
|
||||
});
|
||||
core.info("login_arguments:");
|
||||
core.info(JSON.stringify(login_arguments, null, 2));
|
||||
|
||||
const errorMessage = validateAuthentication(token, username, password);
|
||||
if (errorMessage) {
|
||||
core.error(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ScreepsAPI(login_arguments);
|
||||
const response = await api.code.set(branch, files_to_push);
|
||||
core.info(JSON.stringify(response, null, 2));
|
||||
let api = new ScreepsAPI(login_arguments);
|
||||
if (token) {
|
||||
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}`);
|
||||
// await api.auth(username, password, login_arguments));
|
||||
// await api.auth(username, password, login_arguments));
|
||||
const response = Promise.resolve()
|
||||
.then(() => api.auth(username, password, login_arguments))
|
||||
.then(() => {
|
||||
return api.code.set(branch, files_to_push);
|
||||
})
|
||||
.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();
|
||||
|
Reference in New Issue
Block a user