Skip to content

Commit 3b32056

Browse files
feat (OPE-943): Add CI checks for yarn file (#1371)
* ci: add yarn-lock-check workflow to validate root and frontend yarn.lock files * ci: refine yarn-lock-check workflow * Potential fix for code scanning alert no. 35: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * test: empty yarn.lock file * test: no yarn.lock file * test: added yarn.lock file * ci: merge yarn.lock validation into Frontend workflow and remove standalone check --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 1288fde commit 3b32056

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

.github/workflows/frontend.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,64 @@
1-
# TBA
21
name: Frontend
32

4-
on: [pull_request]
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
59

610
jobs:
711
build:
812
runs-on: ubuntu-latest
913
steps:
1014
- name: Checkout
1115
uses: actions/checkout@v4
12-
# Node
16+
1317
- name: Setup Node.js
1418
uses: actions/setup-node@v4
1519
with:
1620
node-version: "20.x"
1721

22+
# Validate yarn.lock files first
23+
- name: Ensure root yarn.lock exists and is valid
24+
run: |
25+
if [ ! -f "yarn.lock" ]; then
26+
echo "Error: Missing root yarn.lock."
27+
echo "Run 'yarn install' and commit the generated lockfile."
28+
exit 1
29+
fi
30+
31+
if [ ! -s "yarn.lock" ]; then
32+
echo "Error: Root yarn.lock exists but is empty."
33+
exit 1
34+
fi
35+
36+
yarn install --immutable
37+
38+
- name: Ensure frontend yarn.lock exists and is valid
39+
run: |
40+
if [ ! -f "frontend/yarn.lock" ]; then
41+
echo "Error: Missing frontend/yarn.lock."
42+
echo "Run 'cd frontend && yarn install' and commit the generated lockfile."
43+
exit 1
44+
fi
45+
46+
if [ ! -s "frontend/yarn.lock" ]; then
47+
echo "Error: frontend/yarn.lock exists but is empty."
48+
exit 1
49+
fi
50+
51+
cd frontend
52+
yarn install --immutable
53+
1854
# Configure Yarn network settings for timeout, retries, and reduced concurrency
1955
- name: Configure Yarn network settings
2056
run: |
2157
yarn config set network-timeout 60000 # Set network timeout to 1 minute
2258
yarn config set network-retries 10 # Retry up to 10 times
2359
yarn config set network-concurrency 2 # Reduce concurrency to 2 connections
2460
25-
# Install dependencies
61+
# Install dependencies (this should be fast since we already validated with --immutable)
2662
- name: Install dependencies
2763
run: yarn install:frontend
2864

0 commit comments

Comments
 (0)