File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 43
43
- run : rustup update stable && rustup default stable
44
44
- run : cargo stale-label
45
45
46
+ check-version-bump :
47
+ runs-on : ubuntu-latest
48
+ env :
49
+ BASE_SHA : ${{ github.event.pull_request.base.sha }}
50
+ COMMIT_SHA : ${{ github.sha }}
51
+ steps :
52
+ - uses : actions/checkout@v3
53
+ with :
54
+ fetch-depth : 0 # make `git diff` work
55
+ - run : rustup update stable && rustup default stable
56
+ - run : ci/validate-version-bump.sh
57
+
46
58
# Ensure Cargo.lock is up-to-date
47
59
lockfile :
48
60
runs-on : ubuntu-latest
@@ -213,6 +225,7 @@ jobs:
213
225
name : bors build finished
214
226
needs :
215
227
- build_std
228
+ - check-version-bump
216
229
- docs
217
230
- lockfile
218
231
- resolver
@@ -229,6 +242,7 @@ jobs:
229
242
name : bors build finished
230
243
needs :
231
244
- build_std
245
+ - check-version-bump
232
246
- docs
233
247
- lockfile
234
248
- resolver
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # This script checks if a crate needs a version bump.
3
+ #
4
+ # At the time of writing, it doesn't check what kind of bump is required.
5
+ # In the future, we could take SemVer compatibliity into account, like
6
+ # integrating `cargo-semver-checks` of else
7
+ #
8
+ # Inputs:
9
+ # BASE_SHA The commit SHA of the branch where the PR wants to merge into.
10
+ # COMMIT_SHA The commit SHA that triggered the workflow.
11
+
12
+ set -euo pipefail
13
+
14
+ # When `BASE_SHA` is missing, we assume it is from bors merge commit,
15
+ # so `HEAD~` should find the previous commit on master branch.
16
+ base_sha=$( git rev-parse " ${BASE_SHA:- HEAD~} " )
17
+ commit_sha=$( git rev-parse " ${COMMIT_SHA:- HEAD} " )
18
+
19
+ echo " Base branch is $base_sha "
20
+ echo " The current is $commit_sha "
21
+
22
+ changed_crates=$(
23
+ git diff --name-only " $base_sha " " $commit_sha " -- crates/ credential/ benches/ \
24
+ | cut -d' /' -f2 \
25
+ | sort -u
26
+ )
27
+
28
+ if [ -z " $changed_crates " ]
29
+ then
30
+ echo " No file changed in sub crates."
31
+ exit 0
32
+ fi
33
+
34
+ output=$(
35
+ echo " $changed_crates " \
36
+ | xargs printf -- ' --package %s\n' \
37
+ | xargs cargo unpublished --check-version-bump
38
+ )
39
+
40
+ if [ -z " $output " ]
41
+ then
42
+ echo " No version bump needed for sub crates."
43
+ exit 0
44
+ fi
45
+
46
+ echo " $output "
47
+ exit 1
You can’t perform that action at this time.
0 commit comments