Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yarn-install failure #393

Merged
merged 3 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/brave-timers-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'davinci-github-actions': patch
---

### yarn-install

- ensure the workflow fails correctly if `yarn install` encounters an error
4 changes: 2 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Node.js 20
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version-file: .nvmrc

- uses: ./yarn-install

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Set up node
uses: actions/[email protected]
with:
node-version: 20
node-version-file: .nvmrc

- uses: ./yarn-install

Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18.3
1 change: 0 additions & 1 deletion build-push-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ This is a list of ENV Variables that are used in GH Action:
| name | description |
| -------------------------- | --------------------------------------------------------- |
| `DOCKER_BUILDX_ENDPOINT` | Docker buildx endpoint (Optional if using for GH runners) |
| `GCR_ACCOUNT_KEY` | Necessary token to push image to Google cloud |
| `GITHUB_TOKEN` | GitHub token. Is used to checkout `davinci` branch |
| `TOPTAL_BUILD_BOT_SSH_KEY` | SSH key to access Google cloud |

Expand Down
13 changes: 9 additions & 4 deletions yarn-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,16 @@ runs:
NPM_TOKEN: ${{ inputs.npm-token || env.NPM_TOKEN }}
MAX_ATTEMPTS: ${{ inputs.max-attempts }}
run: |
for i in {1..$MAX_ATTEMPTS}; do
printf "Trying to install #%s...\n" "$i"
yarn install --non-interactive && break
sleep 10 # 10s wait time
for ((i=1; i<=MAX_ATTEMPTS; i++)); do
echo "Trying to install (${i}/${MAX_ATTEMPTS})..."
if yarn install --non-interactive; then
echo "Yarn install succeeded on attempt ${i}."
exit 0
fi
sleep 10
done
echo "All installation attempts failed. Exiting with error."
exit 1

# We are manually checking for the changes in yarn.lock file, because
# the `--frozen-lockfile` flag is not working correctly in workspaces with yarn v1
Expand Down