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

Commit ed04688

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 e9e0471 commit ed04688

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.ci/static-checks.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ long_options=(
3333
[force]="Force a skipped test to run"
3434
[golang]="Check '.go' files"
3535
[help]="Display usage statement"
36+
[labels]="Check labels databases"
3637
[licenses]="Check licenses"
3738
[branch]="Specify upstream branch to compare against (default '$branch')"
3839
[all]="Force checking of all changes, including files in the base branch"
@@ -271,6 +272,22 @@ check_versions()
271272
fi
272273
}
273274

275+
check_labels()
276+
{
277+
# Since this script is called from another repositories directory,
278+
# ensure the utility is built before the script below (which uses it) is run.
279+
(cd "${tests_dir}" && make github-labels)
280+
281+
tmp=$(mktemp)
282+
283+
info "Checking labels for repo ${repo} using temporary combined database ${tmp}"
284+
285+
bash -f "${tests_dir}/cmd/github-labels/github-labels.sh" "generate" "${repo}" "${tmp}"
286+
287+
# All tests passed so remove combined labels database
288+
rm -f "${tmp}"
289+
}
290+
274291
# Ensure all files (where possible) contain an SPDX license header
275292
check_license_headers()
276293
{
@@ -607,6 +624,7 @@ main()
607624
--force) force="true" ;;
608625
--golang) func=check_go ;;
609626
-h|--help) usage; exit 0 ;;
627+
--labels) func=check_labels;;
610628
--licenses) func=check_license_headers ;;
611629
--repo) repo="$2"; shift ;;
612630
--vendor) func=check_vendor;;
@@ -660,6 +678,7 @@ main()
660678
check_docs
661679
check_files
662680
check_vendor
681+
check_labels
663682
}
664683

665684
main "$@"

0 commit comments

Comments
 (0)