generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 6
45 lines (41 loc) · 1.1 KB
/
.pre.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: .Pre
on:
workflow_call:
jobs:
check:
name: Check Cache
runs-on: ubuntu-latest
outputs:
should-pull: ${{ steps.check.outputs.should-pull }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: check cache
id: check
run: |
CACHE_LIST=$(gh cache list)
if [[ ! -z "$CACHE_LIST" ]]; then
# echo "$CACHE_LIST" | awk 'NR==1{print $1}'
echo "Cache already exists. Skipping dependencies"
echo "should-pull=false" >> $GITHUB_OUTPUT
else
echo "should-pull=true" >> $GITHUB_OUTPUT
fi
shell: bash
dependencies:
name: Pull Dependencies
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.should-pull == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: ./yarn.lock
- name: Clean Yarn cache
run: yarn cache clean
- name: Install dependencies
run: yarn