From 7d69ef2398468e6db13d2d9f762649f9d797ccff Mon Sep 17 00:00:00 2001 From: Rami Lukata <32602478+rlukata@users.noreply.github.com> Date: Tue, 31 Oct 2023 17:34:48 +0100 Subject: [PATCH] Allow env vars (#13) * allow env vars * manually run prettier * rebuild dist * Revert "rebuild dist" This reverts commit 9d562404127f788fe91e072dde1d09ddaf287d30. * rebuild dist using node16 --- action.yml | 4 ++-- dist/restore-only/index.js | 8 +++++--- dist/restore/index.js | 8 +++++--- dist/save-only/index.js | 8 +++++--- dist/save/index.js | 8 +++++--- src/utils/actionUtils.ts | 10 +++++++--- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/action.yml b/action.yml index 4458b2e44..f5462125d 100644 --- a/action.yml +++ b/action.yml @@ -31,10 +31,10 @@ inputs: required: true aws-access-key-id: description: 'An AWS access key id to access the bucket' - required: true + required: false aws-secret-access-key: description: 'An AWS secret access key to access the bucket' - required: true + required: false aws-region: description: 'An AWS region where the bucket is located' required: false diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js index c15822679..5a450e3c5 100644 --- a/dist/restore-only/index.js +++ b/dist/restore-only/index.js @@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() { } const s3config = { credentials: { - accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId), - secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) + accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) || + process.env["AWS_ACCESS_KEY_ID"], + secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) || + process.env["AWS_SECRET_ACCESS_KEY"] }, - region: core.getInput(constants_1.Inputs.AWSRegion), + region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"], endpoint: core.getInput(constants_1.Inputs.AWSEndpoint), bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint), forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle) diff --git a/dist/restore/index.js b/dist/restore/index.js index dc64d7d70..f5586887c 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() { } const s3config = { credentials: { - accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId), - secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) + accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) || + process.env["AWS_ACCESS_KEY_ID"], + secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) || + process.env["AWS_SECRET_ACCESS_KEY"] }, - region: core.getInput(constants_1.Inputs.AWSRegion), + region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"], endpoint: core.getInput(constants_1.Inputs.AWSEndpoint), bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint), forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle) diff --git a/dist/save-only/index.js b/dist/save-only/index.js index d5f65d0c2..fc88726c8 100644 --- a/dist/save-only/index.js +++ b/dist/save-only/index.js @@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() { } const s3config = { credentials: { - accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId), - secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) + accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) || + process.env["AWS_ACCESS_KEY_ID"], + secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) || + process.env["AWS_SECRET_ACCESS_KEY"] }, - region: core.getInput(constants_1.Inputs.AWSRegion), + region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"], endpoint: core.getInput(constants_1.Inputs.AWSEndpoint), bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint), forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle) diff --git a/dist/save/index.js b/dist/save/index.js index aec0a864e..3b174c4e1 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() { } const s3config = { credentials: { - accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId), - secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) + accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) || + process.env["AWS_ACCESS_KEY_ID"], + secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) || + process.env["AWS_SECRET_ACCESS_KEY"] }, - region: core.getInput(constants_1.Inputs.AWSRegion), + region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"], endpoint: core.getInput(constants_1.Inputs.AWSEndpoint), bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint), forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle) diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index fff7de20e..24ae3a017 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -88,10 +88,14 @@ export function getInputS3ClientConfig(): S3ClientConfig | undefined { const s3config = { credentials: { - accessKeyId: core.getInput(Inputs.AWSAccessKeyId), - secretAccessKey: core.getInput(Inputs.AWSSecretAccessKey) + accessKeyId: + core.getInput(Inputs.AWSAccessKeyId) || + process.env["AWS_ACCESS_KEY_ID"], + secretAccessKey: + core.getInput(Inputs.AWSSecretAccessKey) || + process.env["AWS_SECRET_ACCESS_KEY"] }, - region: core.getInput(Inputs.AWSRegion), + region: core.getInput(Inputs.AWSRegion) || process.env["AWS_REGION"], endpoint: core.getInput(Inputs.AWSEndpoint), bucketEndpoint: core.getBooleanInput(Inputs.AWSS3BucketEndpoint), forcePathStyle: core.getBooleanInput(Inputs.AWSS3ForcePathStyle)