File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-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
+ if : github.event_name == 'pull_request'
49
+ env :
50
+ GH_TOKEN : ${{ github.token }}
51
+ PULL_REQUEST_URL : ${{ github.event.pull_request.html_url }}
52
+ steps :
53
+ - uses : actions/checkout@v3
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
+ # PULL_REQUEST_URL A pull request url on GitHub.
10
+
11
+ set -euo pipefail
12
+
13
+ changed_crates=$(
14
+ gh pr view $PULL_REQUEST_URL \
15
+ --json files \
16
+ -q ' .files[].path | match("^(crates|credential|benches)/(.*?)/") | .captures[1].string' \
17
+ | sort -u
18
+ )
19
+
20
+ if [ -z " $changed_crates " ]
21
+ then
22
+ echo " No file changed in sub crates."
23
+ exit 0
24
+ fi
25
+
26
+ output=$( echo " $changed_crates " | xargs printf -- ' --package %s\n' | xargs cargo unpublished --check-version-bump)
27
+
28
+
29
+ if [ -z " $output " ]
30
+ then
31
+ echo " No version bump needed for sub crates."
32
+ exit 0
33
+ fi
34
+
35
+ echo " $output "
36
+
37
+ exit 1
You can’t perform that action at this time.
0 commit comments