This commit is contained in:
parent
11c30e71ca
commit
ae8a515ded
42
action.yaml
Normal file
42
action.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
name: 'Upload to Screeps'
|
||||
description: 'This action uploads code to the Screeps server.'
|
||||
inputs:
|
||||
protocol:
|
||||
description: 'The protocol to use (default: https).'
|
||||
required: false
|
||||
default: 'https'
|
||||
hostname:
|
||||
description: 'The hostname of the Screeps server (default: screeps.com).'
|
||||
required: false
|
||||
default: 'screeps.com'
|
||||
port:
|
||||
description: 'The port to use (default: 443).'
|
||||
required: false
|
||||
default: '443'
|
||||
path:
|
||||
description: 'The path for the API.'
|
||||
required: false
|
||||
default: '/'
|
||||
token:
|
||||
description: 'Authentication token for Screeps.'
|
||||
required: true
|
||||
username:
|
||||
description: 'Username for Screeps account. Used if no token is provided.'
|
||||
required: false
|
||||
password:
|
||||
description: 'Password for Screeps account. Used if no token is provided.'
|
||||
required: false
|
||||
prefix:
|
||||
description: 'Directory prefix for file paths.'
|
||||
required: false
|
||||
pattern:
|
||||
description: 'Glob pattern to match files (default: *.js).'
|
||||
required: false
|
||||
default: '*.js'
|
||||
branch:
|
||||
description: 'Branch in Screeps to which the code will be uploaded (default: default).'
|
||||
required: false
|
||||
default: 'default'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
2
index.js
2
index.js
@ -96,14 +96,12 @@ async function postCode() {
|
||||
"path": path,
|
||||
};
|
||||
|
||||
// TODO: Refactor error handling for cleaner code
|
||||
const errorMessage = validateAuthentication(token, username, password);
|
||||
if (errorMessage) {
|
||||
core.error(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Consider moving log statement after error checks
|
||||
core.log(JSON.stringify(login_arguments, null, 2));
|
||||
|
||||
const api = new ScreepsAPI(login_arguments);
|
||||
|
Loading…
x
Reference in New Issue
Block a user