File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed 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+ 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+
4657 # Ensure Cargo.lock is up-to-date
4758 lockfile :
4859 runs-on : ubuntu-latest
@@ -213,6 +224,7 @@ jobs:
213224 name : bors build finished
214225 needs :
215226 - build_std
227+ - check-version-bump
216228 - docs
217229 - lockfile
218230 - resolver
@@ -229,6 +241,7 @@ jobs:
229241 name : bors build finished
230242 needs :
231243 - build_std
244+ - check-version-bump
232245 - docs
233246 - lockfile
234247 - 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