22 Commits

Author SHA1 Message Date
2b9a04a136 Changed the dict order again.
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:54:46 +01:00
3eeeb73e0e Reworked the login arguments again. 2023-11-26 21:54:05 +01:00
7c75b9d000 Reworked a message. 2023-11-26 21:50:25 +01:00
7933a62f3a Update the auth function
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:48:39 +01:00
2e271692b0 Tried the logout again.
All checks were successful
Lint / pre-commit Linting (push) Successful in 51s
2023-11-26 21:34:26 +01:00
ad5a6efa14 Commented out a log.
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:30:27 +01:00
b0725e8219 Added jshint as a linter.
Some checks failed
Lint / pre-commit Linting (push) Failing after 1m18s
2023-11-26 21:26:08 +01:00
7b50736f64 Reworked auth again!
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:23:28 +01:00
a114309427 Added more testing.
All checks were successful
Lint / pre-commit Linting (push) Successful in 50s
2023-11-26 21:06:25 +01:00
8c4feac99a Reworked index,js
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:05:09 +01:00
d9aa117ac6 Reworked everything.
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:01:42 +01:00
dbd765cbdf Reworked index.
All checks were successful
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:59:44 +01:00
c69726c600 Reworked something
All checks were successful
Lint / pre-commit Linting (push) Successful in 47s
2023-11-26 20:57:33 +01:00
14f1218845 Removed the auth step.
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 20:56:15 +01:00
368ba86559 Reworked the login
All checks were successful
Lint / pre-commit Linting (push) Successful in 49s
2023-11-26 20:52:00 +01:00
dd929af281 Reworkeed the function to use Promice resolve
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 20:50:28 +01:00
ddd15b4063 Added an await token to the autorization
All checks were successful
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:21:47 +01:00
a312781dc7 Reworked a bit of logging.
All checks were successful
Lint / pre-commit Linting (push) Successful in 50s
2023-11-26 20:13:10 +01:00
7f5df4a59e Reworked everything a bit.
All checks were successful
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:10:35 +01:00
9be17fd1a0 Reworked the username.
All checks were successful
Lint / pre-commit Linting (push) Successful in 53s
2023-11-26 19:59:04 +01:00
bc56766110 Added a bit more logging.
All checks were successful
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 19:56:56 +01:00
0537c5a914 Added an local rebuilding.
All checks were successful
Lint / pre-commit Linting (push) Successful in 45s
2023-11-26 19:54:59 +01:00

View File

@ -90,12 +90,11 @@ 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,
@ -106,20 +105,34 @@ async function postCode() {
path: path,
};
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}`);
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 to ${branch}`);
})
.catch((err) => {
console.error("Error:", err);
});
core.info("Authorized!");
core.info(JSON.stringify(response, null, 2));
}
}
postCode();