Skip to content

Commit 72e1784

Browse files
committed
CI: have workflow install Yarn if not present
This is useful e.g. for act [1] if using the medium-sized image. Taken from user @francis-switcho’s comment on actions/setup-node. [2] [1]: https://github.com/nektos/act#default-runners-are-intentionally-incomplete [2]: actions/setup-node#182 (comment)
1 parent ef60d6b commit 72e1784

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/unit-tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,23 @@ jobs:
77
runs-on: ubuntu-22.04
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
11+
12+
- name: Install yarn if not present
13+
run: |-
14+
if which yarn; then
15+
exit
16+
fi
17+
curl -fsSL --create-dirs -o ~/bin/yarn \
18+
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js
19+
chmod +x ~/bin/yarn
20+
echo ~/bin >> "${GITHUB_PATH}"
1121
1222
- name: Use specified Node.js version
13-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v3
1424
with:
1525
node-version-file: .nvmrc
26+
cache: yarn
1627

1728
- name: Install dependencies
1829
run: yarn install

0 commit comments

Comments
 (0)