-
Notifications
You must be signed in to change notification settings - Fork 554
Add cache-write input for read-only cache mode #710
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,12 @@ process.on('uncaughtException', e => { | |||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| export async function run() { | ||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||
| const cacheWriteEnabled = core.getInput('cache-write'); | ||||||||||||||||||||||||||||||||||||||||||||
| if (cacheWriteEnabled === 'false') { | ||||||||||||||||||||||||||||||||||||||||||||
| core.info('Cache write is disabled (read-only mode). Skipping cache save.'); | ||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (core.getBooleanInput('cache')) { | ||||||||||||||||||||||||||||||||||||||||||||
| await cachePackages(); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
24
|
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
25
|
||||||||||||||||||||||||||||||||||||||||||||
| const cacheWriteEnabled = core.getInput('cache-write'); | |
| if (cacheWriteEnabled === 'false') { | |
| core.info('Cache write is disabled (read-only mode). Skipping cache save.'); | |
| return; | |
| } | |
| if (core.getBooleanInput('cache')) { | |
| await cachePackages(); | |
| } | |
| const cacheEnabled = core.getBooleanInput('cache'); | |
| if (!cacheEnabled) { | |
| return; | |
| } | |
| const cacheWriteEnabled = core.getInput('cache-write'); | |
| if (cacheWriteEnabled === 'false') { | |
| core.info('Cache write is disabled (read-only mode). Skipping cache save.'); | |
| return; | |
| } | |
| await cachePackages(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache-writeis defined as a boolean input (action.yml default: true), but the code reads it withcore.getInput()and compares to the exact string'false'. This is brittle (e.g.,False/FALSE/whitespace won’t be treated as false) and could unintentionally enable cache writes. Prefercore.getBooleanInput('cache-write')and negate it for the early-return check.