Skip to content

Commit f3c2633

Browse files
committed
scripts: add pr_matches_label()
Signed-off-by: Casey Bodley <[email protected]>
1 parent 071c1bb commit f3c2633

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ceph-pull-requests/build/build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ if ! pr_matches_codeowner "@ceph/rbd"; then
1515
echo "No rbd files changed. No need to run rbd unit tests."
1616
export CHECK_MAKEOPTS="-E run-rbd-unit-tests"
1717
fi
18+
if pr_matches_label "rbd"; then
19+
echo "Pull request contains rbd label"
20+
fi
1821
timeout 3h ./run-make-check.sh
1922
sleep 5
2023
ps -ef | grep -v jnlp | grep ceph || true

scripts/build_utils.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,16 @@ pr_matches_codeowner() {
18431843
return 0
18441844
}
18451845

1846+
# return success (0) if the pr has the given label
1847+
pr_matches_label() {
1848+
local target=$1
1849+
local labels=$(curl -s -u ${GITHUB_USER}:${GITHUB_PASS} https://api.github.com/repos/${ghprbGhRepository}/issues/${ghprbPullId}/labels | jq '.[].name' | tr -d '"')
1850+
for label in $labels; do
1851+
if [ $label = $target ]; then return 0; fi
1852+
done
1853+
return 1
1854+
}
1855+
18461856
function ssh_exec() {
18471857
if [[ -z $SSH_ADDRESS ]]; then
18481858
echo "ERROR: Env variable SSH_ADDRESS is not set"

0 commit comments

Comments
 (0)