diff --git a/.github/workflows/pull-request-kotlin.yml b/.github/workflows/pull-request-kotlin.yml index 6ca4a46..7b896af 100644 --- a/.github/workflows/pull-request-kotlin.yml +++ b/.github/workflows/pull-request-kotlin.yml @@ -90,14 +90,27 @@ jobs: with: distribution: corretto java-version: ${{ inputs.java-version }} - cache: 'gradle' - - name: Cache SonarCloud packages - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + - name: Restore Gradle cache + id: gradle-cache + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ github.head_ref }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-gradle-${{ github.head_ref }}- + ${{ runner.os }}-gradle- + - name: Restore SonarCloud cache + id: sonar-cache if: ${{ !inputs.skip-sonar }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar + key: ${{ runner.os }}-sonar-${{ github.head_ref }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-sonar-${{ github.head_ref }}- + ${{ runner.os }}-sonar- - name: Run linter env: GHL_USERNAME: ${{ secrets.GHL_USERNAME }} @@ -158,3 +171,17 @@ jobs: **/build/test-results/**/*.xml **/build/test-results/**/*.trx **/build/test-results/**/*.json + - name: Save Gradle cache + if: ${{ always() && steps.gradle-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ github.head_ref }}-${{ github.sha }} + - name: Save SonarCloud cache + if: ${{ always() && !inputs.skip-sonar && steps.sonar-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar-${{ github.head_ref }}-${{ github.sha }}