mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-02 05:55:10 +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:
+6
-3
@@ -478,7 +478,8 @@ async function run() {
|
||||
!AccessKeyId &&
|
||||
!process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'] &&
|
||||
!roleChaining) {
|
||||
core.info('It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission?');
|
||||
core.info('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 (!!roleToAssume &&
|
||||
!!process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'] &&
|
||||
@@ -519,10 +520,12 @@ async function run() {
|
||||
// in any error messages.
|
||||
(0, helpers_1.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