Skip to content

Commit dbca1e9

Browse files
committed
cache node_modules
1 parent 7a8873a commit dbca1e9

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/actions/install-deps/action.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,36 @@ inputs:
1818
runs:
1919
using: 'composite'
2020
steps:
21+
- name: Check if caching should be enabled
22+
id: should-cache
23+
shell: bash
24+
run: |
25+
# Enable caching for PR branches: fe/, be/, fe-be/, feature/, bugfix/
26+
# Skip caching for: ric/, latest, and other release branches
27+
if [[ "${{ github.ref_name }}" =~ ^(fe|be|fe-be|feature|bugfix)/ ]]; then
28+
echo "enabled=true" >> $GITHUB_OUTPUT
29+
echo "🚀 Caching enabled for branch: ${{ github.ref_name }}"
30+
else
31+
echo "enabled=false" >> $GITHUB_OUTPUT
32+
echo "⚡ Caching disabled for branch: ${{ github.ref_name }}"
33+
fi
34+
35+
- name: Cache Yarn dependencies
36+
if: steps.should-cache.outputs.enabled == 'true'
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.cache/yarn
41+
${{ inputs.dir-path }}/node_modules
42+
.yarn/cache
43+
key: ${{ runner.os }}-yarn-${{ inputs.dir-path }}-${{ hashFiles(format('{0}/yarn.lock', inputs.dir-path), format('{0}/package.json', inputs.dir-path)) }}
44+
restore-keys: |
45+
${{ runner.os }}-yarn-${{ inputs.dir-path }}-
46+
${{ runner.os }}-yarn-
47+
2148
- name: Install dependencies
2249
working-directory: ${{ inputs.dir-path }}
2350
shell: bash
24-
25-
# env:
26-
# SKIP_POSTINSTALL: ${{ inputs.skip-postinstall }}
27-
# run: yarn install
2851
run: |
2952
# todo: uncomment after build our binaries
3053
# export npm_config_keytar_binary_host_mirror=${{ inputs.keytar-host-mirror }}

0 commit comments

Comments
 (0)