22 Commits

Author SHA1 Message Date
Philipp 2b9a04a136 Changed the dict order again.
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:54:46 +01:00
Philipp 3eeeb73e0e Reworked the login arguments again. 2023-11-26 21:54:05 +01:00
Philipp 7c75b9d000 Reworked a message. 2023-11-26 21:50:25 +01:00
Philipp 7933a62f3a Update the auth function
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:48:39 +01:00
Philipp 2e271692b0 Tried the logout again.
Lint / pre-commit Linting (push) Successful in 51s
2023-11-26 21:34:26 +01:00
Philipp ad5a6efa14 Commented out a log.
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:30:27 +01:00
Philipp b0725e8219 Added jshint as a linter.
Lint / pre-commit Linting (push) Failing after 1m18s
2023-11-26 21:26:08 +01:00
Philipp 7b50736f64 Reworked auth again!
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:23:28 +01:00
Philipp a114309427 Added more testing.
Lint / pre-commit Linting (push) Successful in 50s
2023-11-26 21:06:25 +01:00
Philipp 8c4feac99a Reworked index,js
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:05:09 +01:00
Philipp d9aa117ac6 Reworked everything.
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 21:01:42 +01:00
Philipp dbd765cbdf Reworked index.
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:59:44 +01:00
Philipp c69726c600 Reworked something
Lint / pre-commit Linting (push) Successful in 47s
2023-11-26 20:57:33 +01:00
Philipp 14f1218845 Removed the auth step.
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 20:56:15 +01:00
Philipp 368ba86559 Reworked the login
Lint / pre-commit Linting (push) Successful in 49s
2023-11-26 20:52:00 +01:00
Philipp dd929af281 Reworkeed the function to use Promice resolve
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 20:50:28 +01:00
Philipp ddd15b4063 Added an await token to the autorization
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:21:47 +01:00
Philipp a312781dc7 Reworked a bit of logging.
Lint / pre-commit Linting (push) Successful in 50s
2023-11-26 20:13:10 +01:00
Philipp 7f5df4a59e Reworked everything a bit.
Lint / pre-commit Linting (push) Successful in 24s
2023-11-26 20:10:35 +01:00
Philipp 9be17fd1a0 Reworked the username.
Lint / pre-commit Linting (push) Successful in 53s
2023-11-26 19:59:04 +01:00
Philipp bc56766110 Added a bit more logging.
Lint / pre-commit Linting (push) Successful in 25s
2023-11-26 19:56:56 +01:00
Philipp 0537c5a914 Added an local rebuilding.
Lint / pre-commit Linting (push) Successful in 45s
2023-11-26 19:54:59 +01:00
+23 -10
View File
@@ -90,12 +90,11 @@ async function postCode() {
const files_to_push = await readFilesIntoDict(pattern, prefix); 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) => { Object.keys(files_to_push).forEach((key) => {
core.info(`Key: ${key}`); core.info(`Key: ${key}`);
}); });
core.info(files_to_push);
const login_arguments = { const login_arguments = {
token: token, token: token,
username: username, username: username,
@@ -106,20 +105,34 @@ async function postCode() {
path: path, path: path,
}; };
core.info(`Trying to upload the following files to ${branch}:`); core.info("login_arguments:");
Object.keys(login_arguments).forEach((key) => { core.info(JSON.stringify(login_arguments, null, 2));
core.info(`Key: ${key}`);
});
const errorMessage = validateAuthentication(token, username, password); const errorMessage = validateAuthentication(token, username, password);
if (errorMessage) { if (errorMessage) {
core.error(errorMessage); core.error(errorMessage);
return; return;
} }
let api = new ScreepsAPI(login_arguments);
const api = new ScreepsAPI(login_arguments); if (token) {
const response = await api.code.set(branch, files_to_push); const response = await api.code.set(branch, files_to_push);
core.info(JSON.stringify(response, null, 2)); 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(); postCode();