ci: Split vcpkg tools cache into restore/save
What changed, and why it matters
This is a routine GitHub Actions CI maintenance change. It splits a single cache step into separate 'restore' and 'save' steps so that downloaded vcpkg tools are only saved back to the cache when the workflow runs on the project's default branch. There is no security vulnerability or user-facing bug here.
No security action needed. This is a normal CI optimization/hygiene change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies .github/workflows/ci.yml for the Windows CI job. Previously the vcpkg tools cache used actions/cache@v5, which restores and then always saves the cache at the end of the job. The change replaces it with actions/cache/restore@v5 at the start and adds a conditional actions/cache/save@v5 step after the build. The save now only runs for non-pull-request pushes to the default branch and only when there was no cache hit. This matches the pattern already used for other caches in the same workflow and avoids polluting the cache with per-branch/PR entries.
Changed components
.github/workflows/ci.ymlWindows CI jobvcpkg tools cacheInspect captured patch +12 / −3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e59c64b9..14442f20 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -259,11 +259,13 @@ jobs:
run: |
echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "$GITHUB_ENV"
- - name: vcpkg tools cache
- uses: actions/cache@v5
+ - name: Restore vcpkg tools cache
+ id: vcpkg-tools-cache
+ uses: actions/cache/restore@v5
with:
path: C:/vcpkg/downloads/tools
- key: ${{ github.job }}-vcpkg-tools
+ key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }}
+ restore-keys: ${{ github.job }}-vcpkg-tools-
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
@@ -283,6 +285,13 @@ jobs:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
+ - name: Save vcpkg tools cache
+ uses: actions/cache/save@v5
+ if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-tools-cache.outputs.cache-hit != 'true'
+ with:
+ path: C:/vcpkg/downloads/tools
+ key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }}
+
- name: Build
run: |
py -3 .github/ci-windows.py ${{ matrix.job-type }} build
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.