mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-08-31 05:35:04 +09:00
fix: action fails when intending to use existing credentials (#796)
* fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials --------- Co-authored-by: Tom Keller <1083460+kellertk@users.noreply.github.com>
This commit is contained in:
+8
-3
@@ -78,7 +78,8 @@ export async function run() {
|
||||
!roleChaining
|
||||
) {
|
||||
core.info(
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission?'
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission? ' +
|
||||
'If you are not trying to authenticate with OIDC and the action is working successfully, you can ignore this message.'
|
||||
);
|
||||
}
|
||||
return (
|
||||
@@ -127,11 +128,15 @@ export async function run() {
|
||||
// the source credentials to already be masked as secrets
|
||||
// in any error messages.
|
||||
exportCredentials({ AccessKeyId, SecretAccessKey, SessionToken });
|
||||
} else if (!webIdentityTokenFile && !roleChaining) {
|
||||
} else if (
|
||||
!webIdentityTokenFile &&
|
||||
!roleChaining &&
|
||||
!(process.env['AWS_ACCESS_KEY_ID'] && process.env['AWS_SECRET_ACCESS_KEY'])
|
||||
) {
|
||||
throw new Error('Could not determine how to assume credentials. Please check your inputs and try again.');
|
||||
}
|
||||
|
||||
if (AccessKeyId || roleChaining) {
|
||||
if (AccessKeyId || roleChaining || (process.env['AWS_ACCESS_KEY_ID'] && process.env['AWS_SECRET_ACCESS_KEY'])) {
|
||||
// Validate that the SDK can actually pick up credentials.
|
||||
// This validates cases where this action is using existing environment credentials,
|
||||
// and cases where the user intended to provide input credentials but the secrets inputs resolved to empty strings.
|
||||
|
||||
Reference in New Issue
Block a user