Compare commits

...

3 Commits

Author SHA1 Message Date
Salman Chishti
bad0d63a0a
Merge 4a6270ada6 into 78961f6f84 2026-04-13 18:00:28 -07:00
Salman Chishti
4a6270ada6 style: run prettier on cache-save.ts 2026-03-09 07:11:12 -07:00
Salman Chishti
c948a2c163 feat: add cache-write input for read-only cache mode
Add a 'cache-write' input (default: true) that controls whether the cache
is saved at the end of the workflow. When set to 'false', the action will
restore cached dependencies but skip saving, providing a read-only cache
mode.

This is useful for preventing cache poisoning attacks from untrusted PR
builds while still benefiting from cached dependencies.
2026-03-09 05:35:59 -07:00
3 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,9 @@ inputs:
default: true
cache-dependency-path:
description: 'Used to specify the path to a dependency file (e.g., go.mod, go.sum)'
cache-write:
description: 'Whether to save the cache at the end of the workflow. Set to false for cache read-only mode, useful for preventing cache poisoning from untrusted PR builds.'
default: true
architecture:
description: 'Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.'
go-download-base-url:

View File

@ -46360,6 +46360,11 @@ process.on('uncaughtException', e => {
function run(earlyExit) {
return __awaiter(this, void 0, void 0, function* () {
try {
const cacheWriteEnabled = core.getInput('cache-write');
if (cacheWriteEnabled === 'false') {
core.info('Cache write is disabled (read-only mode). Skipping cache save.');
return;
}
const cacheInput = core.getBooleanInput('cache');
if (cacheInput) {
yield cachePackages();

View File

@ -18,6 +18,14 @@ process.on('uncaughtException', e => {
export async function run(earlyExit?: boolean) {
try {
const cacheWriteEnabled = core.getInput('cache-write');
if (cacheWriteEnabled === 'false') {
core.info(
'Cache write is disabled (read-only mode). Skipping cache save.'
);
return;
}
const cacheInput = core.getBooleanInput('cache');
if (cacheInput) {
await cachePackages();