Skip to content

Commit be526b7

Browse files
ci(yarn): fail install if package changes were not applied (#401)
#401
1 parent 5f77b5d commit be526b7

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
@@ -50,7 +50,7 @@ jobs:
5050
registry-url: https://registry.npmjs.org/
5151

5252
- name: Install Dependencies
53-
run: yarn
53+
run: yarn --frozen-lockfile
5454

5555
# - name: Linter Checks
5656
# run: yarn lint

.github/workflows/checks.yml

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

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

.github/workflows/release.yml

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

7575
# - name: Linter Checks
7676
# run: yarn lint

0 commit comments

Comments
 (0)