Compare commits

..

34 Commits

Author SHA1 Message Date
Alisha Kulkarni f24d7193d9 Merge pull request #1331 from aws-actions/release-please--branches--main--components--configure-aws-credentials
chore(main): release 4.2.0
2025-05-06 13:18:00 -07:00
Alisha Kulkarni f6095d9dc4 Merge branch 'main' into release-please--branches--main--components--configure-aws-credentials 2025-05-06 13:16:29 -07:00
dependabot[bot] df1fa04984 chore(deps-dev): bump memfs from 4.17.0 to 4.17.1 (#1348)
Bumps [memfs](https://github.com/streamich/memfs) from 4.17.0 to 4.17.1.
- [Release notes](https://github.com/streamich/memfs/releases)
- [Changelog](https://github.com/streamich/memfs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/streamich/memfs/compare/v4.17.0...v4.17.1)

---
updated-dependencies:
- dependency-name: memfs
  dependency-version: 4.17.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 03:48:41 +00:00
dependabot[bot] 1c397386a2 chore(deps-dev): bump @types/node from 22.15.3 to 22.15.11 (#1345)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.15.3 to 22.15.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.15.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 03:46:27 +00:00
AWS SDKs and Tools bot 21e0c4b1ca chore(main): release 4.2.0 2025-05-05 20:44:51 -07:00
GitHub Actions b0f2baf098 chore: Update dist 2025-05-06 03:44:51 +00:00
dependabot[bot] 4320d1b180 chore(deps): bump @aws-sdk/client-sts from 3.798.0 to 3.803.0 (#1346)
Bumps [@aws-sdk/client-sts](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-sts) from 3.798.0 to 3.803.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sts/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.803.0/clients/client-sts)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-sts"
  dependency-version: 3.803.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 03:44:09 +00:00
dependabot[bot] 5d1959cbc9 chore(deps): bump vite from 6.3.2 to 6.3.4 (#1344)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.2 to 6.3.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-30 17:43:18 +00:00
GitHub Actions 3ecfae8a2c chore: Update dist 2025-04-29 03:22:08 +00:00
dependabot[bot] 2f26d75abd chore(deps): bump @aws-sdk/client-sts from 3.787.0 to 3.798.0 (#1342)
Bumps [@aws-sdk/client-sts](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-sts) from 3.787.0 to 3.798.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sts/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.798.0/clients/client-sts)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-sts"
  dependency-version: 3.798.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 03:21:33 +00:00
dependabot[bot] 658557f884 chore(deps-dev): bump @types/node from 22.14.1 to 22.15.3 (#1341)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.14.1 to 22.15.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.15.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 03:19:12 +00:00
GitHub Actions f157a6574f chore: Update dist 2025-04-25 23:12:05 +00:00
Tom Keller 9e38641911 fix: role chaning on mulitple runs (#1340) 2025-04-25 16:11:28 -07:00
Tom Keller 2c168adcae feat: support action inputs as environment variables (#1338)
* support action inputs as environment variables

* update dist

* fix: update tsconfig for package step

* fix: update environment variable setting method

* fix: make biome happy

---------

Co-authored-by: Michael Lehmann <lehmanmj@amazon.com>
2025-04-25 13:15:03 -07:00
GitHub Actions 4d5f2395c0 chore: Update dist 2025-04-24 22:55:35 +00:00
Michael Lehmann a4f326760c Merge pull request #1337 from aws-actions/output-expiration
feat: add Expiration field to Outputs
2025-04-24 15:55:00 -07:00
Michael Lehmann 93edf43b3a document outputs in readme 2025-04-24 15:42:59 -07:00
Michael Lehmann fe54dce1bb update dist with changes 2025-04-24 15:05:57 -07:00
Michael Lehmann 423f4e15fb Add Expiration field to output 2025-04-24 14:14:16 -07:00
Michael Lehmann 11e58be8bc Merge pull request #1336 from aws-actions/lehmanmj-patch-1
chore: Update README.md
2025-04-24 12:16:29 -07:00
Michael Lehmann 7f5e3139fe Update README.md
update readme.md to provide a suggestion for altering the role-session-name for easier auditability
2025-04-24 12:09:12 -07:00
Michael Lehmann 5a0cf0167f Merge pull request #1334 from aws-actions/lehmanmj-patch-1
feat: Document role-duration-seconds range
2025-04-23 10:50:01 -07:00
Michael Lehmann adb43a2cd3 Update README.md 2025-04-23 10:34:14 -07:00
dependabot[bot] e62ae06aa8 chore(deps-dev): bump @types/node from 22.13.1 to 22.14.1 (#1326)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.13.1 to 22.14.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.14.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 23:45:50 +00:00
dependabot[bot] 66d7591932 chore(deps-dev): bump typescript from 5.7.3 to 5.8.3 (#1323)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.3 to 5.8.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.3...v5.8.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.8.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 23:43:22 +00:00
GitHub Actions 76dfa67953 chore: Update dist 2025-04-22 23:41:36 +00:00
dependabot[bot] ab246ce5fb chore(deps): bump esbuild, @vitest/coverage-v8 and vitest (#1333)
Bumps [esbuild](https://github.com/evanw/esbuild) to 0.25.2 and updates ancestor dependencies [esbuild](https://github.com/evanw/esbuild), [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) and [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest). These dependencies need to be updated together.


Updates `esbuild` from 0.21.5 to 0.25.2
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.5...v0.25.2)

Updates `@vitest/coverage-v8` from 2.1.9 to 3.1.2
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v3.1.2/packages/coverage-v8)

Updates `vitest` from 2.1.9 to 3.1.2
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v3.1.2/packages/vitest)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-version: 0.25.2
  dependency-type: indirect
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 3.1.2
  dependency-type: direct:development
- dependency-name: vitest
  dependency-version: 3.1.2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 23:40:59 +00:00
GitHub Actions ca537c9527 chore: Update dist 2025-04-22 23:39:29 +00:00
dependabot[bot] 72a198126f chore(deps): bump @aws-sdk/client-sts from 3.741.0 to 3.787.0 (#1325)
Bumps [@aws-sdk/client-sts](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-sts) from 3.741.0 to 3.787.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sts/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.787.0/clients/client-sts)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-sts"
  dependency-version: 3.787.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 23:38:50 +00:00
dependabot[bot] 203a39c651 chore(deps): bump vite from 5.4.14 to 5.4.18 (#1332)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.14 to 5.4.18.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.18/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.18/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.18
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 23:36:33 +00:00
Michael Lehmann c401b8a98c Merge pull request #1330 from aws-actions/dependabot-and-build-test
fix: make sure action builds, also fix dependabot autoapprove
2025-04-22 16:34:27 -07:00
Michael Lehmann 27e906a655 make sure action builds, also fix dependabot autoapprove 2025-04-22 16:20:34 -07:00
Alisha Kulkarni 483d6b517a Merge pull request #1329 from aws-actions/alikulka-patch-1
chore: Update README.md
2025-04-17 14:56:31 -07:00
Alisha Kulkarni c7765366a4 Update README.md
Updated version tags in examples to reflect the latest semantic version.
2025-04-17 13:35:40 -07:00
26 changed files with 2811 additions and 1926 deletions
+6 -2
View File
@@ -1,8 +1,12 @@
name: Dependabot auto-approve
on: pull_request
on:
pull_request:
workflow_dispatch:
permissions:
pull-requests: write
id-token: write
contents: read
jobs:
dependabot:
runs-on: ubuntu-latest
@@ -17,7 +21,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
role-to-assume: arn:aws:iam::206735643321:role/ConfigureAwsCredentialsPackageRole
role-duration-seconds: 900
- name: Get bot user token
uses: aws-actions/aws-secretsmanager-get-secrets@v2
+1 -1
View File
@@ -1,5 +1,5 @@
{
".release-please-manifest.json": "4.0.2",
"package.json": "4.0.2",
".": "4.1.0"
".": "4.2.0"
}
+15
View File
@@ -2,6 +2,21 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [4.2.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.1.0...v4.2.0) (2025-05-06)
### Features
* add Expiration field to Outputs ([a4f3267](https://github.com/aws-actions/configure-aws-credentials/commit/a4f326760c1c1bf49ab86051c658d6501816b930))
* Document role-duration-seconds range ([5a0cf01](https://github.com/aws-actions/configure-aws-credentials/commit/5a0cf0167f837dfa7af7d951ba6a78a38dc2b79e))
* support action inputs as environment variables ([#1338](https://github.com/aws-actions/configure-aws-credentials/issues/1338)) ([2c168ad](https://github.com/aws-actions/configure-aws-credentials/commit/2c168adcae62d67531ba83842723c8f30695116a))
### Bug Fixes
* make sure action builds, also fix dependabot autoapprove ([c401b8a](https://github.com/aws-actions/configure-aws-credentials/commit/c401b8a98c5067672f52e0387cdd87d54acfe1fd))
* role chaning on mulitple runs ([#1340](https://github.com/aws-actions/configure-aws-credentials/issues/1340)) ([9e38641](https://github.com/aws-actions/configure-aws-credentials/commit/9e386419117a9edd458297e4f1822a5df7506a03))
## [4.1.0](https://github.com/aws-actions/configure-aws-credentials/compare/v4.0.3...v4.1.0) (2025-02-08)
+22 -16
View File
@@ -105,13 +105,13 @@ See [action.yml](./action.yml) for more detail.
| audience | The JWT audience when using OIDC. Used in non-default AWS partitions, like China regions. | No |
| http-proxy | An HTTP proxy to use for API calls. | No |
| mask-aws-account-id | AWS account IDs are not considered secret. Setting this will hide account IDs from output anyway. | No |
| role-duration-seconds | The assumed role duration in seconds, if assuming a role. Defaults to 1 hour. | No |
| role-duration-seconds | The assumed role duration in seconds, if assuming a role. Defaults to 1 hour (3600 seconds). Acceptable values range from 15 minutes (900 seconds) to 12 hours (43200 seconds). | No |
| role-external-id | The external ID of the role to assume. Only needed if your role requires it. | No |
| role-session-name | Defaults to "GitHubActions", but may be changed if required. | No |
| role-skip-session-tagging | Skips session tagging if set. | No |
| inline-session-policy | You may further restrict the assumed role policy by defining an inline policy here. | No |
| managed-session-policies | You may further restrict the assumed role policy by specifying a managed policy here. | No |
| output-credentials | When set, outputs fetched credentials as action step output. Defaults to false. | No |
| output-credentials | When set, outputs fetched credentials as action step output. (Outputs access-key-id, secret-access-key, session-token, and expiration). Defaults to false. | No |
| unset-current-credentials | When set, attempts to unset any existing credentials in your action runner. | No |
| disable-retry | Disabled retry/backoff logic for assume role calls. By default, retries are enabled. | No |
| retry-max-attempts | Limits the number of retry attempts before giving up. Defaults to 12. | No |
@@ -131,7 +131,13 @@ with the `role-external-id` input
#### Session tagging and name
The default session name is "GitHubActions", and you can modify it by specifying
the desired name in `role-session-name`. The session will be tagged with the
the desired name in `role-session-name`.
_Note: you might find it helpful to set the `role-session-name` to `${{ github.run_id }}`
so as to clarify in audit logs which AWS actions were performed by which workflow
run._
The session will be tagged with the
following tags: (Refer to [GitHub's documentation for `GITHUB_` environment
variable definitions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables))
@@ -184,7 +190,7 @@ line like this:
```
Or we can have a nicely formatted JSON as well:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
inline-session-policy: >-
{
@@ -205,13 +211,13 @@ The Amazon Resource Names (ARNs) of the IAM managed policies that you want to
use as managed session policies. The policies must exist in the same account as
the role. You can pass a single managed policy like this:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
managed-session-policies: arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
```
And we can pass multiple managed policies likes this:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
managed-session-policies: |
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
@@ -286,7 +292,7 @@ You can specify the audience through the `audience` input:
```yaml
- name: Configure AWS Credentials for China region audience
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
audience: sts.amazonaws.com.cn
aws-region: us-east-3
@@ -421,7 +427,7 @@ You can use this action to simply configure the region and account ID in the
environment, and then use the runner's credentials for all AWS API calls made by
your Actions workflow:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
```
@@ -431,7 +437,7 @@ APIs called by your Actions workflow.
Or, you can use this action to assume a role, and then use the role credentials
for all AWS API calls made by your Actions workflow:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: my-github-actions-role
@@ -453,7 +459,7 @@ variable.
Manually configured proxy:
```yaml
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: my-github-actions-role
@@ -480,7 +486,7 @@ should include the AWS CLI by default.
### AssumeRoleWithWebIdentity (recommended)
```yaml
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
@@ -494,13 +500,13 @@ environment variable and use it to assume the role
### AssumeRole with role previously assumed by action in same workflow
```yaml
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
role-session-name: MySessionName
- name: Configure other AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::987654321000:role/my-second-role
@@ -515,7 +521,7 @@ role, `arn:aws:iam::987654321000:role/my-second-role`.
### AssumeRole with static IAM credentials in repository secrets
```yaml
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -534,7 +540,7 @@ name, like `role-to-assume: my-github-actions-role`.
```yaml
- name: Configure AWS Credentials 1
id: creds
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
@@ -543,7 +549,7 @@ name, like `role-to-assume: my-github-actions-role`.
run: |
aws sts get-caller-identity
- name: Configure AWS Credentials 2
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
aws-region: us-east-2
aws-access-key-id: ${{ steps.creds.outputs.aws-access-key-id }}
-14
View File
@@ -1,14 +0,0 @@
import { STSClient } from '@aws-sdk/client-sts';
export interface CredentialsClientProps {
region?: string;
proxyServer?: string;
}
export declare class CredentialsClient {
region?: string;
private _stsClient?;
private readonly requestHandler?;
constructor(props: CredentialsClientProps);
get stsClient(): STSClient;
validateCredentials(expectedAccessKeyId?: string, roleChaining?: boolean): Promise<void>;
private loadCredentials;
}
-17
View File
@@ -1,17 +0,0 @@
import type { CredentialsClient } from './CredentialsClient';
export interface assumeRoleParams {
credentialsClient: CredentialsClient;
roleToAssume: string;
roleDuration: number;
roleSessionName: string;
roleSkipSessionTagging?: boolean;
sourceAccountId?: string;
roleExternalId?: string;
webIdentityTokenFile?: string;
webIdentityToken?: string;
inlineSessionPolicy?: string;
managedSessionPolicies?: {
arn: string;
}[];
}
export declare function assumeRole(params: assumeRoleParams): Promise<import("@aws-sdk/client-sts").AssumeRoleCommandOutput>;
-11
View File
@@ -1,11 +0,0 @@
/**
* When the GitHub Actions job is done, clean up any environment variables that
* may have been set by the configure-aws-credentials steps in the job.
*
* Environment variables are not intended to be shared across different jobs in
* the same GitHub Actions workflow: GitHub Actions documentation states that
* each job runs in a fresh instance. However, doing our own cleanup will
* give us additional assurance that these environment variables are not shared
* with any other jobs.
*/
export declare function cleanup(): void;
Generated Vendored
-17
View File
@@ -1,17 +0,0 @@
import type { Credentials } from '@aws-sdk/client-sts';
import type { CredentialsClient } from './CredentialsClient';
export declare function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean): void;
export declare function unsetCredentials(): void;
export declare function exportRegion(region: string): void;
export declare function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: boolean): Promise<string>;
export declare function sanitizeGitHubVariables(name: string): string;
export declare function defaultSleep(ms: number): Promise<unknown>;
declare let sleep: typeof defaultSleep;
export declare function withsleep(s: typeof sleep): void;
export declare function reset(): void;
export declare function verifyKeys(creds: Partial<Credentials> | undefined): boolean;
export declare function retryAndBackoff<T>(fn: () => Promise<T>, isRetryable: boolean, maxRetries?: number, retries?: number, base?: number): Promise<T>;
export declare function errorMessage(error: unknown): string;
export declare function isDefined<T>(i: T | undefined | null): i is T;
export declare function areCredentialsValid(credentialsClient: CredentialsClient): Promise<boolean>;
export {};
Generated Vendored
-1
View File
@@ -1 +0,0 @@
export declare function run(): Promise<void>;
Generated Vendored
+876 -449
View File
File diff suppressed because it is too large Load Diff
-14
View File
@@ -1,14 +0,0 @@
import { STSClient } from '@aws-sdk/client-sts';
export interface CredentialsClientProps {
region?: string;
proxyServer?: string;
}
export declare class CredentialsClient {
region?: string;
private _stsClient?;
private readonly requestHandler?;
constructor(props: CredentialsClientProps);
get stsClient(): STSClient;
validateCredentials(expectedAccessKeyId?: string, roleChaining?: boolean): Promise<void>;
private loadCredentials;
}
-17
View File
@@ -1,17 +0,0 @@
import type { CredentialsClient } from './CredentialsClient';
export interface assumeRoleParams {
credentialsClient: CredentialsClient;
roleToAssume: string;
roleDuration: number;
roleSessionName: string;
roleSkipSessionTagging?: boolean;
sourceAccountId?: string;
roleExternalId?: string;
webIdentityTokenFile?: string;
webIdentityToken?: string;
inlineSessionPolicy?: string;
managedSessionPolicies?: {
arn: string;
}[];
}
export declare function assumeRole(params: assumeRoleParams): Promise<import("@aws-sdk/client-sts").AssumeRoleCommandOutput>;
-11
View File
@@ -1,11 +0,0 @@
/**
* When the GitHub Actions job is done, clean up any environment variables that
* may have been set by the configure-aws-credentials steps in the job.
*
* Environment variables are not intended to be shared across different jobs in
* the same GitHub Actions workflow: GitHub Actions documentation states that
* each job runs in a fresh instance. However, doing our own cleanup will
* give us additional assurance that these environment variables are not shared
* with any other jobs.
*/
export declare function cleanup(): void;
-16
View File
@@ -1,16 +0,0 @@
import type { Credentials } from '@aws-sdk/client-sts';
import type { CredentialsClient } from './CredentialsClient';
export declare function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean): void;
export declare function unsetCredentials(): void;
export declare function exportRegion(region: string): void;
export declare function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: boolean): Promise<string>;
export declare function sanitizeGitHubVariables(name: string): string;
export declare function defaultSleep(ms: number): Promise<unknown>;
declare let sleep: typeof defaultSleep;
export declare function withsleep(s: typeof sleep): void;
export declare function reset(): void;
export declare function verifyKeys(creds: Partial<Credentials> | undefined): boolean;
export declare function retryAndBackoff<T>(fn: () => Promise<T>, isRetryable: boolean, maxRetries?: number, retries?: number, base?: number): Promise<T>;
export declare function errorMessage(error: unknown): string;
export declare function isDefined<T>(i: T | undefined | null): i is T;
export {};
-1
View File
@@ -1 +0,0 @@
export declare function run(): Promise<void>;
-1
View File
@@ -1 +0,0 @@
export {};
-1
View File
@@ -1 +0,0 @@
export {};
-1
View File
@@ -1 +0,0 @@
export {};
-74
View File
@@ -1,74 +0,0 @@
import type * as core from '@actions/core';
declare const _default: {
readonly outputs: {
STS_CREDENTIALS: {
Credentials: {
AccessKeyId: string;
SecretAccessKey: string;
SessionToken: string;
Expiration: Date;
};
AssumedRoleUser: {
Arn: string;
AssumedRoleId: string;
};
};
GET_CALLER_IDENTITY: {
Account: string;
Arn: string;
};
FAKE_STS_ACCESS_KEY_ID: string;
FAKE_STS_SECRET_ACCESS_KEY: string;
FAKE_STS_SESSION_TOKEN: string;
ODD_CHARACTER_CREDENTIALS: {
Credentials: {
AccessKeyId: string;
SecretAccessKey: string;
SessionToken: string;
Expiration: Date;
};
AssumedRoleUser: {
Arn: string;
AssumedRoleId: string;
};
};
};
readonly envs: {
GITHUB_REPOSITORY: string;
GITHUB_WORKFLOW: string;
GITHUB_ACTION: string;
GITHUB_ACTOR: string;
GITHUB_SHA: string;
GITHUB_WORKSPACE: string;
GITHUB_ACTIONS: string;
};
readonly GH_OIDC_INPUTS: {
'role-to-assume': string;
'aws-region': string;
'special-characters-workaround': string;
};
readonly IAM_USER_INPUTS: {
'aws-access-key-id': string;
'aws-secret-access-key': string;
'aws-region': string;
};
readonly IAM_ASSUMEROLE_INPUTS: {
'aws-access-key-id': string;
'aws-secret-access-key': string;
'role-to-assume': string;
'aws-region': string;
};
readonly WEBIDENTITY_TOKEN_FILE_INPUTS: {
'web-identity-token-file': string;
'role-to-assume': string;
'aws-region': string;
};
readonly EXISTING_ROLE_INPUTS: {
'role-to-assume': string;
'role-chaining': string;
'aws-region': string;
};
readonly getInput: (fakeEnv: Record<string, string>) => (name: string, options?: core.InputOptions) => string;
readonly getMultilineInput: (fakeEnv: Record<string, string[]>) => (name: string, options?: core.InputOptions) => string[];
};
export default _default;
Generated Vendored
+936 -489
View File
File diff suppressed because it is too large Load Diff
+910 -762
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -1,12 +1,12 @@
{
"name": "configure-aws-credentials",
"description": "A GitHub Action to configure AWS credentials",
"version": "4.1.0",
"version": "4.2.0",
"scripts": {
"build": "tsc",
"lint": "biome check --error-on-warnings ./src",
"package": "npm run build && ncc build --license THIRD-PARTY -o dist && ncc build src/cleanup/index.ts -o dist/cleanup && cpy dist/THIRD-PARTY . && del-cli dist/THIRD-PARTY",
"test": "npm run lint && vitest run"
"test": "npm run lint && vitest run && npm run build"
},
"author": {
"name": "Amazon.com, Inc. or its affiliates",
@@ -17,21 +17,21 @@
"@aws-sdk/credential-provider-env": "^3.515.0",
"@biomejs/biome": "1.9.4",
"@smithy/property-provider": "^4.0.1",
"@types/node": "^22.13.1",
"@types/node": "^22.15.11",
"@vercel/ncc": "^0.38.3",
"@vitest/coverage-v8": "^2.1.9",
"@vitest/coverage-v8": "^3.1.2",
"aws-sdk-client-mock": "^4.1.0",
"cpy-cli": "^5.0.0",
"del-cli": "^6.0.0",
"json-schema": "^0.4.0",
"memfs": "^4.17.0",
"memfs": "^4.17.1",
"standard-version": "^9.5.0",
"typescript": "^5.7.3",
"vitest": "^2.1.9"
"typescript": "^5.8.3",
"vitest": "^3.1.2"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@aws-sdk/client-sts": "^3.741.0",
"@aws-sdk/client-sts": "^3.803.0",
"@smithy/node-http-handler": "^4.0.1",
"https-proxy-agent": "^5.0.1"
},
+32
View File
@@ -7,6 +7,35 @@ const MAX_TAG_VALUE_LENGTH = 256;
const SANITIZATION_CHARACTER = '_';
const SPECIAL_CHARS_REGEX = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/;
export function translateEnvVariables() {
const envVars = [
'AWS_REGION',
'ROLE_TO_ASSUME',
'WEB_IDENTITY_TOKEN_FILE',
'ROLE_CHAINING',
'AUDIENCE',
'HTTP_PROXY',
'MASK_AWS_ACCOUNT_ID',
'ROLE_DURATION_SECONDS',
'ROLE_EXTERNAL_ID',
'ROLE_SESSION_NAME',
'ROLE_SKIP_SESSION_TAGGING',
'INLINE_SESSION_POLICY',
'MANAGED_SESSION_POLICIES',
'OUTPUT_CREDENTIALS',
'UNSET_CURRENT_CREDENTIALS',
'DISABLE_RETRY',
'RETRY_MAX_ATTEMPTS',
'SPECIAL_CHARACTERS_WORKAROUND',
'USE_EXISTING_CREDENTIALS',
];
for (const envVar of envVars) {
if (process.env[envVar]) {
process.env[`INPUT_${envVar.replace(/_/g, '-')}`] = process.env[envVar];
}
}
}
// Configure the AWS CLI and AWS SDKs using environment variables and set them as secrets.
// Setting the credentials as secrets masks them in Github Actions logs
export function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean) {
@@ -38,6 +67,9 @@ export function exportCredentials(creds?: Partial<Credentials>, outputCredential
if (creds?.SessionToken) {
core.setOutput('aws-session-token', creds.SessionToken);
}
if (creds?.Expiration) {
core.setOutput('aws-expiration', creds.Expiration);
}
}
}
+2
View File
@@ -9,6 +9,7 @@ import {
exportCredentials,
exportRegion,
retryAndBackoff,
translateEnvVariables,
unsetCredentials,
verifyKeys,
} from './helpers';
@@ -19,6 +20,7 @@ const REGION_REGEX = /^[a-z0-9-]+$/g;
export async function run() {
try {
translateEnvVariables();
// Get inputs
const AccessKeyId = core.getInput('aws-access-key-id', { required: false });
const SecretAccessKey = core.getInput('aws-secret-access-key', {
+2 -2
View File
@@ -27,8 +27,8 @@ describe('Configure AWS Credentials helpers', {}, () => {
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test' }, true);
expect(core.setOutput).toHaveBeenCalledTimes(3);
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) }, true);
expect(core.setOutput).toHaveBeenCalledTimes(4);
expect(core.setSecret).toHaveBeenCalledTimes(3);
expect(core.exportVariable).toHaveBeenCalledTimes(3);
});
+1 -1
View File
@@ -13,7 +13,7 @@
"module": "CommonJS",
"resolveJsonModule": true,
"outDir": "build",
"declaration": true,
"declaration": false,
"newLine": "lf",
"noEmitOnError": true,
"sourceMap": true,