Skip to content

Commit b011f39

Browse files
authored
Use our custom boolean parsing (#478)
Fixes GH-477
1 parent 71f9864 commit b011f39

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ inputs:
5656
description: |-
5757
If true, the action will securely generate a credentials file which can be
5858
used for authentication via gcloud and Google Cloud SDKs.
59-
default: true
59+
default: 'true'
6060
required: false
6161
export_environment_variables:
6262
description: |-
@@ -79,7 +79,7 @@ inputs:
7979
If false, the action will not export any environment variables, meaning
8080
future steps are unlikely to be automatically authenticated to Google
8181
Cloud.
82-
default: true
82+
default: 'true'
8383
required: false
8484
token_format:
8585
description: |-
@@ -113,7 +113,7 @@ inputs:
113113
If true, the action will remove any created credentials from the
114114
filesystem upon completion. This only applies if "create_credentials_file"
115115
is true.
116-
default: true
116+
default: 'true'
117117
required: false
118118

119119
# access token params
@@ -175,7 +175,7 @@ inputs:
175175
generated token. If true, the token will contain "email" and
176176
"email_verified" claims. This is only valid when "token_format" is
177177
"id_token".
178-
default: false
178+
default: 'false'
179179
required: false
180180

181181
outputs:

src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { join as pathjoin } from 'path';
1616

1717
import {
1818
exportVariable,
19-
getBooleanInput,
2019
getIDToken,
2120
getInput,
2221
setFailed,
@@ -29,6 +28,7 @@ import {
2928
isEmptyDir,
3029
isPinnedToHead,
3130
parseMultilineCSV,
31+
parseBoolean,
3232
parseDuration,
3333
pinnedToHeadWarning,
3434
} from '@google-github-actions/actions-utils';
@@ -79,8 +79,8 @@ export async function run(logger: Logger) {
7979
const oidcTokenAudience =
8080
getInput(`audience`) || `https://iam.googleapis.com/${workloadIdentityProvider}`;
8181
const credentialsJSON = getInput(`credentials_json`);
82-
const createCredentialsFile = getBooleanInput(`create_credentials_file`);
83-
const exportEnvironmentVariables = getBooleanInput(`export_environment_variables`);
82+
const createCredentialsFile = parseBoolean(getInput(`create_credentials_file`));
83+
const exportEnvironmentVariables = parseBoolean(getInput(`export_environment_variables`));
8484
const tokenFormat = getInput(`token_format`);
8585
const delegates = parseMultilineCSV(getInput(`delegates`));
8686
const universe = getInput(`universe`);
@@ -301,7 +301,7 @@ export async function run(logger: Logger) {
301301
logger.debug(`Creating id token`);
302302

303303
const idTokenAudience = getInput('id_token_audience', { required: true });
304-
const idTokenIncludeEmail = getBooleanInput('id_token_include_email');
304+
const idTokenIncludeEmail = parseBoolean(getInput('id_token_include_email'));
305305

306306
// Ensure a service_account was provided if using WIF.
307307
if (!serviceAccount) {

src/post.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import { getBooleanInput, setFailed } from '@actions/core';
15+
import { getInput, setFailed } from '@actions/core';
1616

17-
import { errorMessage, forceRemove } from '@google-github-actions/actions-utils';
17+
import { errorMessage, forceRemove, parseBoolean } from '@google-github-actions/actions-utils';
1818

1919
import { Logger } from './logger';
2020

2121
export async function run(logger: Logger) {
2222
try {
23-
const createCredentials = getBooleanInput('create_credentials_file');
23+
const createCredentials = parseBoolean(getInput('create_credentials_file'));
2424
if (!createCredentials) {
2525
logger.info(`Skipping credential cleanup - "create_credentials_file" is false.`);
2626
return;
2727
}
2828

29-
const cleanupCredentials = getBooleanInput('cleanup_credentials');
29+
const cleanupCredentials = parseBoolean(getInput('cleanup_credentials'));
3030
if (!cleanupCredentials) {
3131
logger.info(`Skipping credential cleanup - "cleanup_credentials" is false.`);
3232
return;

0 commit comments

Comments
 (0)