Use our custom boolean parsing (#478)

Fixes GH-477
This commit is contained in:
Seth Vargo 2025-04-24 08:53:29 -07:00 committed by GitHub
parent 71f986410d
commit b011f3988e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View File

@ -56,7 +56,7 @@ inputs:
description: |-
If true, the action will securely generate a credentials file which can be
used for authentication via gcloud and Google Cloud SDKs.
default: true
default: 'true'
required: false
export_environment_variables:
description: |-
@ -79,7 +79,7 @@ inputs:
If false, the action will not export any environment variables, meaning
future steps are unlikely to be automatically authenticated to Google
Cloud.
default: true
default: 'true'
required: false
token_format:
description: |-
@ -113,7 +113,7 @@ inputs:
If true, the action will remove any created credentials from the
filesystem upon completion. This only applies if "create_credentials_file"
is true.
default: true
default: 'true'
required: false
# access token params
@ -175,7 +175,7 @@ inputs:
generated token. If true, the token will contain "email" and
"email_verified" claims. This is only valid when "token_format" is
"id_token".
default: false
default: 'false'
required: false
outputs:

View File

@ -16,7 +16,6 @@ import { join as pathjoin } from 'path';
import {
exportVariable,
getBooleanInput,
getIDToken,
getInput,
setFailed,
@ -29,6 +28,7 @@ import {
isEmptyDir,
isPinnedToHead,
parseMultilineCSV,
parseBoolean,
parseDuration,
pinnedToHeadWarning,
} from '@google-github-actions/actions-utils';
@ -79,8 +79,8 @@ export async function run(logger: Logger) {
const oidcTokenAudience =
getInput(`audience`) || `https://iam.googleapis.com/${workloadIdentityProvider}`;
const credentialsJSON = getInput(`credentials_json`);
const createCredentialsFile = getBooleanInput(`create_credentials_file`);
const exportEnvironmentVariables = getBooleanInput(`export_environment_variables`);
const createCredentialsFile = parseBoolean(getInput(`create_credentials_file`));
const exportEnvironmentVariables = parseBoolean(getInput(`export_environment_variables`));
const tokenFormat = getInput(`token_format`);
const delegates = parseMultilineCSV(getInput(`delegates`));
const universe = getInput(`universe`);
@ -301,7 +301,7 @@ export async function run(logger: Logger) {
logger.debug(`Creating id token`);
const idTokenAudience = getInput('id_token_audience', { required: true });
const idTokenIncludeEmail = getBooleanInput('id_token_include_email');
const idTokenIncludeEmail = parseBoolean(getInput('id_token_include_email'));
// Ensure a service_account was provided if using WIF.
if (!serviceAccount) {

View File

@ -12,21 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { getBooleanInput, setFailed } from '@actions/core';
import { getInput, setFailed } from '@actions/core';
import { errorMessage, forceRemove } from '@google-github-actions/actions-utils';
import { errorMessage, forceRemove, parseBoolean } from '@google-github-actions/actions-utils';
import { Logger } from './logger';
export async function run(logger: Logger) {
try {
const createCredentials = getBooleanInput('create_credentials_file');
const createCredentials = parseBoolean(getInput('create_credentials_file'));
if (!createCredentials) {
logger.info(`Skipping credential cleanup - "create_credentials_file" is false.`);
return;
}
const cleanupCredentials = getBooleanInput('cleanup_credentials');
const cleanupCredentials = parseBoolean(getInput('cleanup_credentials'));
if (!cleanupCredentials) {
logger.info(`Skipping credential cleanup - "cleanup_credentials" is false.`);
return;