mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-09-02 21:59:22 +00:00
Disable automatic caching for sensitive events (#992)
## Summary - disable `enable-cache: auto` for `pull_request_target`, `workflow_run`, and `release` events - disable automatic caching for tag pushes while leaving branch pushes unchanged - preserve explicit `enable-cache: true` as an override - run a `workflow_run` integration fixture with `act` in pull request CI and verify caching is disabled - document the behavior and update the published bundles ## Testing - `npm run all` - `actionlint .github/workflows/test.yml __tests__/workflows/workflow-run.yml` - `uvx zizmor __tests__/workflows/workflow-run.yml` Closes #984 Refs: pi-session 019fec42-9b26-714e-a359-830ac4401ecd
This commit is contained in:
+14
-1
@@ -98255,7 +98255,20 @@ function getVenvPath(workingDirectory, activateEnvironment2) {
|
||||
function getEnableCache() {
|
||||
const enableCacheInput = getInput("enable-cache");
|
||||
if (enableCacheInput === "auto") {
|
||||
return process.env.RUNNER_ENVIRONMENT === "github-hosted";
|
||||
if (process.env.RUNNER_ENVIRONMENT !== "github-hosted") {
|
||||
return false;
|
||||
}
|
||||
const eventName = process.env.GITHUB_EVENT_NAME;
|
||||
const isTagPush = eventName === "push" && process.env.GITHUB_REF?.startsWith("refs/tags/");
|
||||
if (isTagPush) {
|
||||
info2("Caching is disabled for tag pushes");
|
||||
return false;
|
||||
}
|
||||
if (eventName === "pull_request_target" || eventName === "workflow_run" || eventName === "release") {
|
||||
info2(`Caching is disabled for the ${eventName} event`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return enableCacheInput === "true";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user