@@ -34,6 +34,7 @@ long_options=(
3434 [force]=" Force a skipped test to run"
3535 [golang]=" Check '.go' files"
3636 [help]=" Display usage statement"
37+ [labels]=" Check labels databases"
3738 [licenses]=" Check licenses"
3839 [branch]=" Specify upstream branch to compare against (default '$branch ')"
3940 [all]=" Force checking of all changes, including files in the base branch"
@@ -272,6 +273,24 @@ check_versions()
272273 fi
273274}
274275
276+ check_labels ()
277+ {
278+ [ $( uname -s) != Linux ] && info " Cannot only check labels under Linux" && return
279+
280+ # Since this script is called from another repositories directory,
281+ # ensure the utility is built before the script below (which uses it) is run.
282+ (cd " ${tests_repo_dir} " && make github-labels)
283+
284+ tmp=$( mktemp)
285+
286+ info " Checking labels for repo ${repo} using temporary combined database ${tmp} "
287+
288+ bash -f " ${tests_repo_dir} /cmd/github-labels/github-labels.sh" " generate" " ${repo} " " ${tmp} "
289+
290+ # All tests passed so remove combined labels database
291+ rm -f " ${tmp} "
292+ }
293+
275294# Ensure all files (where possible) contain an SPDX license header
276295check_license_headers ()
277296{
@@ -608,6 +627,7 @@ main()
608627 --force) force=" true" ;;
609628 --golang) func=check_go ;;
610629 -h|--help) usage; exit 0 ;;
630+ --labels) func=check_labels;;
611631 --licenses) func=check_license_headers ;;
612632 --repo) repo=" $2 " ; shift ;;
613633 --vendor) func=check_vendor;;
@@ -661,6 +681,7 @@ main()
661681 check_docs
662682 check_files
663683 check_vendor
684+ check_labels
664685}
665686
666687main " $@ "
0 commit comments