Skip to content

Commit 2cf40be

Browse files
ci: replace string-based label checking with robust jq boolean evaluation in Cloud Build pipeline
1 parent dacee17 commit 2cf40be

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cloudbuild.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ steps:
4141
4242
PR_DATA=$(cat pr_data.json)
4343
44-
# Extract labels and title from PR data (Use $$ to escape bash variables)
45-
PR_LABELS=$(echo "$$PR_DATA" | jq -r '[.labels[].name] | join(",")')
44+
# Extract title from PR data (Use $$ to escape bash variables)
4645
PR_TITLE=$(echo "$$PR_DATA" | jq -r '.title')
4746
48-
# Check if execution labels are present
49-
if [[ "$$PR_LABELS" != *"autorelease: pending"* && "$$PR_LABELS" != *"ci:run-evals"* ]]; then
47+
# Check if execution labels are present using exact matching via jq
48+
if ! echo "$$PR_DATA" | jq -e '.labels | any(.name == "autorelease: pending" or .name == "ci:run-evals")' > /dev/null; then
5049
echo "PR does not have 'autorelease: pending' or 'ci:run-evals' label. Skipping execution."
5150
exit 0
5251
fi

0 commit comments

Comments
 (0)