Skip to content

Commit

Permalink
Default "promote" to true (#362)
Browse files Browse the repository at this point in the history
This restores a v0 and v1 behavior wherein the empty string is
considered "true" instead of "false". Fixes GH-361.
  • Loading branch information
sethvargo authored Apr 29, 2024
1 parent f53a32b commit 693d553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function run(): Promise<void> {
const envVars = parseKVString(getInput('env_vars'));
const imageUrl = presence(getInput('image_url'));
const version = presence(getInput('version'));
const promote = parseBoolean(getInput('promote'));
const promote = parseBoolean(getInput('promote'), true);
const flags = presence(getInput('flags'));
const gcloudVersion = await computeGcloudVersion(getInput('gcloud_version'));
const gcloudComponent = presence(getInput('gcloud_component'));
Expand Down
10 changes: 10 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ test('#run', { concurrency: true }, async (suite) => {
assertMembers(mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1), ['--promote']);
});

await suite.test('sets promote if given the empty string', async (t) => {
const mocks = defaultMocks(t.mock, {
promote: '',
});

await run();

assertMembers(mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1), ['--promote']);
});

await suite.test('sets no-promote if given', async (t) => {
const mocks = defaultMocks(t.mock, {
promote: 'false',
Expand Down

0 comments on commit 693d553

Please sign in to comment.