Sfoglia il codice sorgente

fix(action): add option to clear ccache stats after displaying in cache stats action

TheWildJames 4 mesi fa
parent
commit
1d602bcdb7
1 ha cambiato i file con 14 aggiunte e 4 eliminazioni
  1. 14 4
      .github/actions/cache-stats/action.yml

+ 14 - 4
.github/actions/cache-stats/action.yml

@@ -1,5 +1,11 @@
 name: 'Show Cache Stats'
 description: 'Displays statistics for ccache and Bazel remote cache to help analyze cache performance and hit rates'
+inputs:
+  clear_stats:
+    description: 'Whether to clear ccache stats after displaying (default: true)'
+    required: true
+    type: boolean
+    default: true
 
 runs:
   using: 'composite'
@@ -53,10 +59,14 @@ runs:
         echo "hit_rate=${HIT_RATE}%"
         echo "direct_rate=${DIRECT_RATE}%"
 
-        echo "=== ccache reset ==="
-        echo "====================="
-        ccache -z || true
-        echo "====================="
+        if [ "${{ inputs.clear_stats }}" = "true" ]; then
+          echo "=== ccache reset ==="
+          echo "====================="
+          ccache -z || true
+          echo "====================="
+        else
+          echo "Keeping ccache stats for next run"
+        fi
 
     - name: Show ccache folder Stats
       shell: bash