Skip to content

Commit

Permalink
Use getBooleanInput to parse flags (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella authored Mar 22, 2024
1 parent 7482e94 commit 033248a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ inputs:
description: 'Signing key secret retrieved after creating binary cache on https://cachix.org'
skipPush:
description: 'Set to true to disable pushing build results to the cache'
default: 'false'
pathsToPush:
description: 'Whitespace-separated list of paths to push. Leave empty to push every build result.'
pushFilter:
Expand All @@ -21,9 +22,10 @@ inputs:
description: 'Extra command-line arguments to pass to cachix. If empty, defaults to -j8'
skipAddingSubstituter:
description: 'Set to true to skip adding cachix cache as a substitute'
default: 'false'
useDaemon:
description: "Push store paths to the cache as they're built with the Cachix Daemon"
default: true
default: 'true'
cachixBin:
description: 'Provide a custom path to the cachix binary'
installCommand:
Expand Down
8 changes: 4 additions & 4 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7740,11 +7740,11 @@ const name = core.getInput('name', { required: true });
const extraPullNames = core.getInput('extraPullNames');
const signingKey = core.getInput('signingKey');
const authToken = core.getInput('authToken');
const skipPush = core.getInput('skipPush');
const skipPush = core.getBooleanInput('skipPush');
const pathsToPush = core.getInput('pathsToPush');
const pushFilter = core.getInput('pushFilter');
const cachixArgs = core.getInput('cachixArgs');
const skipAddingSubstituter = core.getInput('skipAddingSubstituter');
const skipAddingSubstituter = core.getBooleanInput('skipAddingSubstituter');
const useDaemon = core.getBooleanInput('useDaemon');
const cachixBinInput = core.getInput('cachixBin');
const installCommand = core.getInput('installCommand') ||
Expand Down Expand Up @@ -7782,7 +7782,7 @@ async function setup() {
if (authToken !== "") {
await exec.exec(cachixBin, ['authtoken', authToken]);
}
if (skipAddingSubstituter === 'true') {
if (skipAddingSubstituter) {
core.info('Not adding Cachix cache to substituters as skipAddingSubstituter is set to true');
}
else {
Expand Down Expand Up @@ -7860,7 +7860,7 @@ async function upload() {
const cachixBin = core.getState('cachixBin');
const supportsDaemon = core.getState('supportsDaemon') === 'true';
try {
if (skipPush === 'true') {
if (skipPush) {
core.info('Pushing is disabled as skipPush is set to true');
}
else if (signingKey !== "" || authToken !== "") {
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const name = core.getInput('name', { required: true });
const extraPullNames = core.getInput('extraPullNames');
const signingKey = core.getInput('signingKey');
const authToken = core.getInput('authToken')
const skipPush = core.getInput('skipPush');
const skipPush = core.getBooleanInput('skipPush');
const pathsToPush = core.getInput('pathsToPush');
const pushFilter = core.getInput('pushFilter');
const cachixArgs = core.getInput('cachixArgs');
const skipAddingSubstituter = core.getInput('skipAddingSubstituter');
const skipAddingSubstituter = core.getBooleanInput('skipAddingSubstituter');
const useDaemon = core.getBooleanInput('useDaemon');
const cachixBinInput = core.getInput('cachixBin');
const installCommand =
Expand Down Expand Up @@ -64,7 +64,7 @@ async function setup() {
await exec.exec(cachixBin, ['authtoken', authToken]);
}

if (skipAddingSubstituter === 'true') {
if (skipAddingSubstituter) {
core.info('Not adding Cachix cache to substituters as skipAddingSubstituter is set to true')
} else {
core.startGroup(`Cachix: using cache ` + name);
Expand Down Expand Up @@ -156,7 +156,7 @@ async function upload() {
const supportsDaemon = core.getState('supportsDaemon') === 'true';

try {
if (skipPush === 'true') {
if (skipPush) {
core.info('Pushing is disabled as skipPush is set to true');
} else if (signingKey !== "" || authToken !== "") {
if (useDaemon && supportsDaemon) {
Expand Down

0 comments on commit 033248a

Please sign in to comment.