Skip to content

Use our custom boolean parsing #478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand All @@ -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: |-
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { join as pathjoin } from 'path';

import {
exportVariable,
getBooleanInput,
getIDToken,
getInput,
setFailed,
Expand All @@ -29,6 +28,7 @@ import {
isEmptyDir,
isPinnedToHead,
parseMultilineCSV,
parseBoolean,
parseDuration,
pinnedToHeadWarning,
} from '@google-github-actions/actions-utils';
Expand Down Expand Up @@ -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`);
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading