Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit a5a3dd8

Browse files
author
James O. D. Hunt
committed
CI: Update static-check script to check labels
Add a `--labels` option to `static-checks.sh` to allow the combined labels database to be checked. Signed-off-by: James O. D. Hunt <[email protected]>
1 parent 781bb7e commit a5a3dd8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.ci/static-checks.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 "Can 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
276295
check_license_headers()
277296
{
@@ -614,6 +633,7 @@ main()
614633
--force) force="true" ;;
615634
--golang) func=check_go ;;
616635
-h|--help) usage; exit 0 ;;
636+
--labels) func=check_labels;;
617637
--licenses) func=check_license_headers ;;
618638
--repo) repo="$2"; shift ;;
619639
--vendor) func=check_vendor;;
@@ -667,6 +687,7 @@ main()
667687
check_docs
668688
check_files
669689
check_vendor
690+
check_labels
670691
}
671692

672693
main "$@"

0 commit comments

Comments
 (0)