浏览代码

forgejo/workflows: only upload cache if key changed

Timo Rothenpieler 3 月之前
父节点
当前提交
2d64d1129f
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      .forgejo/workflows/test.yml

+ 2 - 0
.forgejo/workflows/test.yml

@@ -19,6 +19,7 @@ jobs:
       - name: Build
       - name: Build
         run: make -j$(nproc)
         run: make -j$(nproc)
       - name: Restore Cached Fate-Suite
       - name: Restore Cached Fate-Suite
+        id: cache
         uses: actions/cache/restore@v4
         uses: actions/cache/restore@v4
         with:
         with:
           path: fate-suite
           path: fate-suite
@@ -32,6 +33,7 @@ jobs:
           echo "hash=$(find fate-suite -type f | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
           echo "hash=$(find fate-suite -type f | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
       - name: Cache Fate-Suite
       - name: Cache Fate-Suite
         uses: actions/cache/save@v4
         uses: actions/cache/save@v4
+        if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
         with:
         with:
           path: fate-suite
           path: fate-suite
           key: fate-suite-${{ steps.fate.outputs.hash }}
           key: fate-suite-${{ steps.fate.outputs.hash }}