@@ -34,41 +34,11 @@ jobs:
34
34
uses : actions/dependency-review-action@v4
35
35
36
36
37
- check-changelog :
38
- name : " Check CHANGELOG"
39
- runs-on : ubuntu-latest
40
- steps :
41
- - name : Checkout code
42
- uses : actions/checkout@v4
43
- with :
44
- # Fetch full history for comparison
45
- fetch-depth : 0
46
- - name : Determine if branch is a feature branch
47
- id : check_feature_branch
48
- run : |
49
- if [[ "${{ github.head_ref || github.ref_name }} " =~ ^feature/* ]]; then
50
- echo "is_feature=true" >> $GITHUB_ENV
51
- else
52
- echo "is_feature=false" >> $GITHUB_ENV
53
- fi
54
- - name : Check if CHANGELOG.md has changed
55
- if : env.is_feature == 'true'
56
- run : |
57
- # Compare the CHANGELOG.md file in the current branch with the `develop` branch
58
- if git diff --name-only origin/develop...HEAD | grep -q '^CHANGELOG.md$'; then
59
- echo "CHANGELOG.md has been updated."
60
- else
61
- echo "CHANGELOG.md has not been updated."
62
- exit 1
63
- fi
64
-
65
-
66
37
install-ui :
67
38
name : " Install UI"
68
39
runs-on : ubuntu-latest
69
40
needs :
70
41
- dependency-review
71
- - check-changelog
72
42
steps :
73
43
- name : Checkout repository
74
44
uses : actions/checkout@v4
@@ -165,7 +135,6 @@ jobs:
165
135
runs-on : ubuntu-latest
166
136
needs :
167
137
- dependency-review
168
- - check-changelog
169
138
steps :
170
139
- name : Checkout repository
171
140
uses : actions/checkout@v4
@@ -210,9 +179,6 @@ jobs:
210
179
rm -r tests/
211
180
echo "fn main() {}" > src/main.rs
212
181
cargo build --all-targets --locked --quiet
213
-
214
- rustup component add rustfmt
215
- rustup component add clippy
216
182
217
183
218
184
check-api :
@@ -264,6 +230,7 @@ jobs:
264
230
toolchain : ${{ env.RUST_VERSION }}
265
231
profile : minimal
266
232
override : true
233
+ components : clippy, rustfmt
267
234
- name : Restore cargo registry
268
235
uses : actions/cache/restore@v4
269
236
with :
@@ -286,7 +253,7 @@ jobs:
286
253
- name : Run clippy
287
254
run : |
288
255
cd api
289
- cargo clippy --frozen
256
+ cargo clippy --frozen --quiet
290
257
291
258
292
259
test-api :
@@ -346,3 +313,54 @@ jobs:
346
313
run : |
347
314
kill $(cat api.pid)
348
315
docker compose down
316
+
317
+
318
+ check-changelog :
319
+ name : " Check CHANGELOG"
320
+ runs-on : ubuntu-latest
321
+ steps :
322
+ - name : Checkout code
323
+ uses : actions/checkout@v4
324
+ with :
325
+ # Fetch full history for comparison
326
+ fetch-depth : 0
327
+ - name : Determine if branch is a feature branch
328
+ id : check_feature_branch
329
+ run : |
330
+ if [[ "${{ github.head_ref || github.ref_name }} " =~ ^feature/* ]]; then
331
+ echo "is_feature=true" >> $GITHUB_ENV
332
+ else
333
+ echo "is_feature=false" >> $GITHUB_ENV
334
+ fi
335
+ - name : Check if CHANGELOG.md has changed
336
+ if : env.is_feature == 'true'
337
+ continue-on-error : true
338
+ run : |
339
+ # Compare the CHANGELOG.md file in the current branch with the `develop` branch
340
+ if git diff --name-only origin/develop...HEAD | grep -q '^CHANGELOG.md$'; then
341
+ echo "CHANGELOG.md has been updated."
342
+ else
343
+ echo "::warning file=CHANGELOG.md::CHANGELOG.md has not been updated."
344
+ exit 1
345
+ exit 1
346
+ fi
347
+
348
+
349
+ prefer-single-commit :
350
+ name : " Prefer Single Commit"
351
+ runs-on : ubuntu-latest
352
+ steps :
353
+ - name : Checkout code
354
+ uses : actions/checkout@v4
355
+ with :
356
+ # Fetch full history for comparison
357
+ fetch-depth : 0
358
+ - name : Count commits
359
+ id : count_commits
360
+ run : |
361
+ commit_count=$(git rev-list --count HEAD ^origin/${{ github.event.pull_request.base.ref }})
362
+ echo "commit_count=$commit_count" >> $GITHUB_ENV
363
+ - name : Fail if more than one commit
364
+ if : env.commit_count > 1
365
+ run : |
366
+ echo "::error title=Please Squash your PR::Pull request contains more than one commit ($commit_count commits). Please squash your commits."
0 commit comments