Skip to content

Commit

Permalink
Release v1.0.1 with support for AWS session tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
abhilash1in authored Feb 1, 2021
1 parent 27f88de commit 3a814c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: action-factory/[email protected].0
- uses: action-factory/[email protected].1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For example:
```yaml
steps:
- name: Read secrets from AWS Secrets Manager into environment variables
uses: action-factory/[email protected].0
uses: action-factory/[email protected].1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32028,6 +32028,7 @@ var Inputs;
(function (Inputs) {
Inputs["AWS_ACCESS_KEY_ID"] = "aws-access-key-id";
Inputs["AWS_SECRET_ACCESS_KEY"] = "aws-secret-access-key";
Inputs["AWS_SESSION_TOKEN"] = "aws-session-token";
Inputs["AWS_REGION"] = "aws-region";
Inputs["SECRETS"] = "secrets";
Inputs["PARSE_JSON"] = "parse-json";
Expand Down Expand Up @@ -32108,8 +32109,12 @@ const shouldParseJSON = (core.getInput(Inputs.PARSE_JSON).trim().toLowerCase() =
const AWSConfig = {
accessKeyId: core.getInput(Inputs.AWS_ACCESS_KEY_ID),
secretAccessKey: core.getInput(Inputs.AWS_SECRET_ACCESS_KEY),
region: core.getInput(Inputs.AWS_REGION),
region: core.getInput(Inputs.AWS_REGION)
};
const awsSessionToken = core.getInput(Inputs.AWS_SESSION_TOKEN);
if (awsSessionToken) {
AWSConfig['sessionToken'] = awsSessionToken;
}
const getSecretsManagerClient = (config) => new aws.SecretsManager(config);
const getSecretValue = (secretsManagerClient, secretName) => secretsManagerClient.getSecretValue({ SecretId: secretName }).promise();
const listSecretsPaginated = (secretsManagerClient, nextToken) => secretsManagerClient.listSecrets({ NextToken: nextToken }).promise();
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const inputSecretNames: string[] = [...new Set(core.getInput(Inputs.SECRETS).spl
// Check if any secret name contains a wildcard '*'
const hasWildcard: boolean = inputSecretNames.some(secretName => secretName.includes('*'))
const shouldParseJSON = (core.getInput(Inputs.PARSE_JSON).trim().toLowerCase() === 'true')
const AWSConfig: any = {
const AWSConfig = {
accessKeyId: core.getInput(Inputs.AWS_ACCESS_KEY_ID),
secretAccessKey: core.getInput(Inputs.AWS_SECRET_ACCESS_KEY),
region: core.getInput(Inputs.AWS_REGION)
}

const awsSessionToken = core.getInput(Inputs.AWS_SESSION_TOKEN)
if (awsSessionToken) {
AWSConfig.sessionToken = awsSessionToken
AWSConfig['sessionToken'] = awsSessionToken
}

const getSecretsManagerClient = (config): SecretsManager => new SecretsManager(config)
Expand Down

0 comments on commit 3a814c2

Please sign in to comment.