Skip to content

Commit

Permalink
Use the env to make save-always work
Browse files Browse the repository at this point in the history
"github.event.inputs" apparently does not contain inputs to the action.
  • Loading branch information
friendlyanon committed Oct 6, 2024
1 parent 4d5a9d4 commit 2d431e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ inputs:

save-always:
default: "false"
description: Always run the "post" script to save whatever is in the cache.
description: >-
Always run the "post" script to save whatever is in the cache, unless the
<skip-save> option is true, in which case the "post" script continues to
do nothing.
outputs:
cache-hit:
Expand All @@ -81,4 +84,4 @@ runs:
using: node20
main: dist/main.js
post: dist/post.js
post-if: github.event.inputs.save-always || success()
post-if: success() || env.SETUP_VCPKG_SAVE_ALWAYS == 'true'
3 changes: 3 additions & 0 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -166569,6 +166569,9 @@ async function main() {
if (coreExports.getBooleanInput("ignore-reserve-cache-error")) {
coreExports.saveState("IGNORE_RESERVE_CACHE_ERROR", "1");
}
if (coreExports.getBooleanInput("save-always")) {
coreExports.exportVariable("SETUP_VCPKG_SAVE_ALWAYS", "true");
}
const isWindows = getOS() === "Windows";
const execOptions = {
cwd: require$$1$4.join(process.env.GITHUB_WORKSPACE, path),
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const enum Inputs {
path = "path",
ignoreReserveCacheError = "ignore-reserve-cache-error",
skipSave = "skip-save",
saveAlways = "save-always",
}

export const enum States {
Expand Down
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async function main() {
core.saveState(States.ignoreReserveCacheError, "1");
}

if (core.getBooleanInput(Inputs.saveAlways)) {
core.exportVariable("SETUP_VCPKG_SAVE_ALWAYS", "true");
}

const isWindows = getOS() === "Windows";
const execOptions = {
cwd: join(process.env.GITHUB_WORKSPACE!, path),
Expand Down

0 comments on commit 2d431e8

Please sign in to comment.