File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 - run : rustup update stable && rustup default stable
4444 - run : cargo stale-label
4545
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+ - run : rustup update stable && rustup default stable
53+ - run : ci/validate-version-bump.sh
54+
4655 # Ensure Cargo.lock is up-to-date
4756 lockfile :
4857 runs-on : ubuntu-latest
@@ -213,6 +222,7 @@ jobs:
213222 name : bors build finished
214223 needs :
215224 - build_std
225+ - check-version-bump
216226 - docs
217227 - lockfile
218228 - resolver
@@ -229,6 +239,7 @@ jobs:
229239 name : bors build finished
230240 needs :
231241 - build_std
242+ - check-version-bump
232243 - docs
233244 - lockfile
234245 - 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:- " HEAD~" } "
16+
17+ changed_crates=$(
18+ git diff --name-only " $rev " -- crates/ credential/ benches/ \
19+ | cut -d' /' -f2 \
20+ | sort -u
21+ )
22+
23+ if [ -z " $changed_crates " ]
24+ then
25+ echo " No file changed in sub crates."
26+ exit 0
27+ fi
28+
29+ output=$(
30+ echo " $changed_crates " \
31+ | xargs printf -- ' --package %s\n' \
32+ | xargs cargo unpublished --check-version-bump
33+ )
34+
35+ if [ -z " $output " ]
36+ then
37+ echo " No version bump needed for sub crates."
38+ exit 0
39+ fi
40+
41+ echo " $output "
42+ exit 1
You can’t perform that action at this time.
0 commit comments