Skip to content
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

Use getBooleanInput to parse flags #176

Merged
merged 4 commits into from
Mar 22, 2024
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
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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the GH Actions documentation, the default value of an input should be specified as a string:

image

Reference: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput_iddefault

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
Loading