From 3c11c8204d27f3d51d4c026d38baef4eceab6c38 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:52:29 +0000 Subject: [PATCH] Rotate SonarCloud cache key with a content hash The static ${{ runner.os }}-sonar key never changed, so ~/.sonar/cache was never refreshed. Key on hashFiles('**/pom.xml') with a prefix restore-key fallback so the cache stays fresh and self-healing. Refs java-helpers/simple-builders#166 Co-Authored-By: Andreas Igel --- .github/workflows/maven.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2f7e1ae4..e451242b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -40,8 +40,10 @@ jobs: uses: actions/cache@v4 with: path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar + # Content-addressed so the cache rotates when project config changes, + # with a prefix fallback for warm restores. + key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-sonar- - name: Cache Maven packages uses: actions/cache@v4