Skip to content

Commit 1d243ce

Browse files
committed
harden cache usage
1 parent d8c8322 commit 1d243ce

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/actions/setup-bun/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ runs:
3333
shell: bash
3434
run: echo "dir=$(bun pm cache)" >> "$GITHUB_OUTPUT"
3535

36-
- name: Cache Bun dependencies
37-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
36+
- name: Restore Bun dependencies
37+
id: bun-cache
38+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3839
with:
3940
path: ${{ steps.cache.outputs.dir }}
4041
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
@@ -56,3 +57,10 @@ runs:
5657
bun install ${{ inputs.install-flags }}
5758
fi
5859
shell: bash
60+
61+
- name: Save Bun dependencies
62+
if: steps.bun-cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request' && github.event_name != 'pull_request_target'
63+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
64+
with:
65+
path: ${{ steps.cache.outputs.dir }}
66+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}

0 commit comments

Comments
 (0)