From aba5ee6a4487eaab9610825f6d857a5af7c1bdb6 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Fri, 19 Jan 2024 15:43:47 -0500 Subject: [PATCH] CI: auto-cache add option to save cache (#31076) * save cache option * inputs old-commit-hash: bbbe94bc3efd9a6de32f4d806a025a734e215a6f --- .../{auto-cache-restore => auto-cache}/action.yaml | 13 ++++++++++++- .github/workflows/setup/action.yaml | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) rename .github/workflows/{auto-cache-restore => auto-cache}/action.yaml (71%) diff --git a/.github/workflows/auto-cache-restore/action.yaml b/.github/workflows/auto-cache/action.yaml similarity index 71% rename from .github/workflows/auto-cache-restore/action.yaml rename to .github/workflows/auto-cache/action.yaml index 0aab3b3eef..523ce9fe8f 100644 --- a/.github/workflows/auto-cache-restore/action.yaml +++ b/.github/workflows/auto-cache/action.yaml @@ -10,6 +10,10 @@ inputs: restore-keys: description: 'restore-keys' required: true + save: + description: 'whether to save the cache' + default: 'false' + required: false runs: using: "composite" @@ -20,7 +24,7 @@ runs: with: path: ${{ inputs.path }} - - name: setup github cache + - name: restore github cache if: ${{ !contains(runner.name, 'nsc') }} uses: actions/cache/restore@v3 with: @@ -32,3 +36,10 @@ runs: - id: scons-cache-setup shell: bash run: mkdir -p ${{ inputs.path }} + + - name: save github cache + if: ${{ !contains(runner.name, 'nsc') && inputs.save != 'false' }} + uses: actions/cache/save@v3 + with: + path: ${{ inputs.path }} + key: ${{ inputs.key }} diff --git a/.github/workflows/setup/action.yaml b/.github/workflows/setup/action.yaml index ec1626c01b..970d62030d 100644 --- a/.github/workflows/setup/action.yaml +++ b/.github/workflows/setup/action.yaml @@ -44,7 +44,7 @@ runs: - shell: bash run: echo "$CACHE_COMMIT_DATE" - id: scons-cache - uses: ./.github/workflows/auto-cache-restore + uses: ./.github/workflows/auto-cache with: path: .ci_cache/scons_cache key: scons-${{ runner.arch }}-${{ env.CACHE_COMMIT_DATE }}-${{ github.sha }}