Skip to content

Commit

Permalink
Merge pull request #15 from SkynetLabs/skynetpro-fix
Browse files Browse the repository at this point in the history
Adjust options to pass JWT to Client, not upload method
  • Loading branch information
kwypchlo authored Jan 28, 2022
2 parents 9662df1 + f986500 commit 4f9491c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ function outputAxiosErrorMessage(error) {
}
}

function prepareClientOptions() {
const options = {};

if (core.getInput("skynet-jwt")) {
// transform skynet-jwt into a cookie accepted format
options.customCookie = `skynet-jwt=${core.getInput("skynet-jwt")}`;
}

return options;
}

function prepareUploadOptions() {
const options = {};

Expand All @@ -32,18 +43,16 @@ function prepareUploadOptions() {
options.errorPages = { 404: core.getInput("not-found-page") };
}

if (core.getInput("skynet-jwt")) {
// transform skynet-jwt into a cookie accepted format
options.customCookie = `skynet-jwt=${core.getInput("skynet-jwt")}`;
}

return options;
}

(async () => {
try {
// upload to skynet
const skynetClient = new SkynetClient(core.getInput("portal-url"));
const skynetClient = new SkynetClient(
core.getInput("portal-url"),
prepareClientOptions()
);
const skylink = await skynetClient.uploadDirectory(
core.getInput("upload-dir"),
prepareUploadOptions()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deploy-to-skynet-action",
"version": "2.0.0",
"version": "2.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4f9491c

Please sign in to comment.