Skip to content

Commit 9985aa8

Browse files
authored
Fix yarn-install failure (#393)
1 parent e4e80c3 commit 9985aa8

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

.changeset/brave-timers-fly.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'davinci-github-actions': patch
3+
---
4+
5+
### yarn-install
6+
7+
- ensure the workflow fails correctly if `yarn install` encounters an error

.github/workflows/pr-checks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ jobs:
4040
with:
4141
ref: ${{ github.event.pull_request.head.sha }}
4242

43-
- name: Set up Node.js 20
43+
- name: Set up Node.js
4444
uses: actions/[email protected]
4545
with:
46-
node-version: 20
46+
node-version-file: .nvmrc
4747

4848
- uses: ./yarn-install
4949

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Set up node
5757
uses: actions/[email protected]
5858
with:
59-
node-version: 20
59+
node-version-file: .nvmrc
6060

6161
- uses: ./yarn-install
6262

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.18.3

build-push-image/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ This is a list of ENV Variables that are used in GH Action:
4242
| name | description |
4343
| -------------------------- | --------------------------------------------------------- |
4444
| `DOCKER_BUILDX_ENDPOINT` | Docker buildx endpoint (Optional if using for GH runners) |
45-
| `GCR_ACCOUNT_KEY` | Necessary token to push image to Google cloud |
4645
| `GITHUB_TOKEN` | GitHub token. Is used to checkout `davinci` branch |
4746
| `TOPTAL_BUILD_BOT_SSH_KEY` | SSH key to access Google cloud |
4847

yarn-install/action.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,16 @@ runs:
161161
NPM_TOKEN: ${{ inputs.npm-token || env.NPM_TOKEN }}
162162
MAX_ATTEMPTS: ${{ inputs.max-attempts }}
163163
run: |
164-
for i in {1..$MAX_ATTEMPTS}; do
165-
printf "Trying to install #%s...\n" "$i"
166-
yarn install --non-interactive && break
167-
sleep 10 # 10s wait time
164+
for ((i=1; i<=MAX_ATTEMPTS; i++)); do
165+
echo "Trying to install (${i}/${MAX_ATTEMPTS})..."
166+
if yarn install --non-interactive; then
167+
echo "Yarn install succeeded on attempt ${i}."
168+
exit 0
169+
fi
170+
sleep 10
168171
done
172+
echo "All installation attempts failed. Exiting with error."
173+
exit 1
169174
170175
# We are manually checking for the changes in yarn.lock file, because
171176
# the `--frozen-lockfile` flag is not working correctly in workspaces with yarn v1

0 commit comments

Comments
 (0)