Skip to content

Commit 0067926

Browse files
ci(yarn): fail install if package changes were not applied (#1628)
1 parent e79ff59 commit 0067926

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
registry-url: https://registry.npmjs.org/
5353

5454
- name: Install Dependencies
55-
run: yarn
55+
run: yarn --frozen-lockfile
5656

5757
- name: Prettier Checks
5858
run: yarn pretty:check

.github/workflows/checks.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,23 @@ jobs:
3939
node-version: 20
4040
registry-url: https://registry.npmjs.org/
4141

42+
# Install Dependencies
43+
# Using --frozen-lockfile first to fail fast if yarn.lock is out of sync
44+
# Run a second time since yarn v1 frozen-lockfile does not notice removed dependencies
4245
- name: Install Dependencies
43-
run: yarn
46+
run: |
47+
yarn --frozen-lockfile
48+
yarn
49+
50+
- name: Check for uncommitted files in working directory
51+
run: |
52+
git_status=$(git status --porcelain)
53+
if [ -n "$git_status" ]; then
54+
echo "Please commit changed files before running checks."
55+
exit 1
56+
else
57+
echo "No modified files found."
58+
fi
4459
4560
- name: Prettier Checks
4661
run: yarn pretty:check

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
echo versions equal - building release ${{ env.REF_NAME }}
7373
7474
- name: Install Dependencies
75-
run: yarn
75+
run: yarn --frozen-lockfile
7676

7777
- name: Linter Checks
7878
run: yarn lint

0 commit comments

Comments
 (0)