While the cached performance is improved (as stated in the initial CL) this change
also tends to bloat our cache with unnecessary things that I believe causes us to get more cache-misses due to more frequent eviction, which can overall hurt presubmit performance. Thus, I'm going to revert this change.

PiperOrigin-RevId: 535734484
diff --git a/.github/actions/artifact-android-emulator-tests/action.yml b/.github/actions/artifact-android-emulator-tests/action.yml
index 393227c..2fc2987 100644
--- a/.github/actions/artifact-android-emulator-tests/action.yml
+++ b/.github/actions/artifact-android-emulator-tests/action.yml
@@ -12,7 +12,14 @@
     - name: 'Check out repository'
       uses: actions/checkout@v3
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Download local snapshot for tests'
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/actions/artifact-android-local-tests/action.yml b/.github/actions/artifact-android-local-tests/action.yml
index 5b6e837..5410985 100644
--- a/.github/actions/artifact-android-local-tests/action.yml
+++ b/.github/actions/artifact-android-local-tests/action.yml
@@ -12,7 +12,14 @@
     - name: 'Check out repository'
       uses: actions/checkout@v3
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Download local snapshot for tests'
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/actions/artifact-java-local-tests/action.yml b/.github/actions/artifact-java-local-tests/action.yml
index 040dbe3..e3cf770 100644
--- a/.github/actions/artifact-java-local-tests/action.yml
+++ b/.github/actions/artifact-java-local-tests/action.yml
@@ -7,7 +7,14 @@
     - name: 'Check out repository'
       uses: actions/checkout@v3
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Download local snapshot for tests'
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/actions/bazel-test/action.yml b/.github/actions/bazel-test/action.yml
index d0469ec..d84f061 100644
--- a/.github/actions/bazel-test/action.yml
+++ b/.github/actions/bazel-test/action.yml
@@ -31,7 +31,14 @@
         restore-keys: |
           ${{ runner.os }}-bazel-test-
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Run Bazel tests'
       run: bazel test --test_output=errors //...
       shell: bash
diff --git a/.github/actions/build-gradle-plugin/action.yml b/.github/actions/build-gradle-plugin/action.yml
index 6e56fde..4fb3293 100644
--- a/.github/actions/build-gradle-plugin/action.yml
+++ b/.github/actions/build-gradle-plugin/action.yml
@@ -33,7 +33,14 @@
         restore-keys: |
           ${{ runner.os }}-bazel-build-
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Install maven version'
       run: ./util/install-maven.sh ${{ env.USE_MAVEN_VERSION }}
       shell: bash
diff --git a/.github/actions/test-gradle-plugin/action.yml b/.github/actions/test-gradle-plugin/action.yml
index f68d79b..5523278 100644
--- a/.github/actions/test-gradle-plugin/action.yml
+++ b/.github/actions/test-gradle-plugin/action.yml
@@ -28,7 +28,14 @@
         restore-keys: |
           ${{ runner.os }}-bazel-build-
     - name: 'Cache Gradle files'
-      uses: gradle/gradle-build-action@v2
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.gradle/caches
+          ~/.gradle/wrapper
+        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+        restore-keys: |
+          ${{ runner.os }}-gradle-
     - name: 'Download local snapshot for tests'
       uses: actions/download-artifact@v3
       with: