File tree 2 files changed +56
-0
lines changed
2 files changed +56
-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_REF : ${{ github.base_ref }}
50
+ steps :
51
+ - uses : actions/checkout@v3
52
+ with :
53
+ fetch-depth : 0 # make `git diff` work
54
+ - run : rustup update stable && rustup default stable
55
+ - run : ci/validate-version-bump.sh
56
+
46
57
# Ensure Cargo.lock is up-to-date
47
58
lockfile :
48
59
runs-on : ubuntu-latest
@@ -213,6 +224,7 @@ jobs:
213
224
name : bors build finished
214
225
needs :
215
226
- build_std
227
+ - check-version-bump
216
228
- docs
217
229
- lockfile
218
230
- resolver
@@ -229,6 +241,7 @@ jobs:
229
241
name : bors build finished
230
242
needs :
231
243
- build_std
244
+ - check-version-bump
232
245
- docs
233
246
- lockfile
234
247
- 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_REF The base branch of the pull request wanting to merge into.
10
+
11
+ set -euo pipefail
12
+
13
+ # When `BASE_REF` is missing, we assume it is from bors merge commit,
14
+ # so `HEAD~` should find the previous commit on master branch.
15
+ rev=" ${BASE_REF: +origin/ $BASE_REF } "
16
+ rev=" ${rev:- HEAD~} "
17
+
18
+ changed_crates=$(
19
+ git diff --name-only " $rev " -- crates/ credential/ benches/ \
20
+ | cut -d' /' -f2 \
21
+ | sort -u
22
+ )
23
+
24
+ if [ -z " $changed_crates " ]
25
+ then
26
+ echo " No file changed in sub crates."
27
+ exit 0
28
+ fi
29
+
30
+ output=$(
31
+ echo " $changed_crates " \
32
+ | xargs printf -- ' --package %s\n' \
33
+ | xargs cargo unpublished --check-version-bump
34
+ )
35
+
36
+ if [ -z " $output " ]
37
+ then
38
+ echo " No version bump needed for sub crates."
39
+ exit 0
40
+ fi
41
+
42
+ echo " $output "
43
+ exit 1
You can’t perform that action at this time.
0 commit comments