Skip to content

Commit 1241dad

Browse files
authored
Merge pull request #1375 from flavio/ci-trigger-rust-and-go-pipelines-with-labels
label-based test execution
2 parents 8cd88a3 + e5a3303 commit 1241dad

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
default: true
1111
push:
1212
pull_request:
13+
types: [opened, synchronize, reopened, labeled]
1314
workflow_dispatch:
1415
inputs:
1516
run_all:
@@ -44,13 +45,36 @@ jobs:
4445
exit 0
4546
fi
4647
47-
# Check if commit message contains [ci full] or [full ci] to run all checks
48-
COMMIT_MSG='${{ github.event.head_commit.message }}'
49-
if echo "$COMMIT_MSG" | grep -qiE '\[(ci full|full ci)\]'; then
50-
echo "Commit message contains [ci full] or [full ci], running all checks"
51-
echo "go=true" >> $GITHUB_OUTPUT
52-
echo "rust=true" >> $GITHUB_OUTPUT
53-
exit 0
48+
# Check for CI trigger labels on PRs
49+
if [ "${{ github.event_name }}" = "pull_request" ]; then
50+
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
51+
echo "PR Labels: $LABELS"
52+
53+
if echo "$LABELS" | grep -q "ci-full"; then
54+
echo "Label 'ci-full' found, running all checks"
55+
echo "go=true" >> $GITHUB_OUTPUT
56+
echo "rust=true" >> $GITHUB_OUTPUT
57+
exit 0
58+
fi
59+
60+
if echo "$LABELS" | grep -q "ci-go"; then
61+
echo "Label 'ci-go' found, running Go checks"
62+
echo "go=true" >> $GITHUB_OUTPUT
63+
fi
64+
65+
if echo "$LABELS" | grep -q "ci-rust"; then
66+
echo "Label 'ci-rust' found, running Rust checks"
67+
echo "rust=true" >> $GITHUB_OUTPUT
68+
fi
69+
70+
# If triggered by label event and we found a matching label, skip path detection
71+
if [ "${{ github.event.action }}" = "labeled" ]; then
72+
LABEL_NAME='${{ github.event.label.name }}'
73+
if [ "$LABEL_NAME" = "ci-full" ] || [ "$LABEL_NAME" = "ci-go" ] || [ "$LABEL_NAME" = "ci-rust" ]; then
74+
echo "Triggered by label event, skipping path detection"
75+
exit 0
76+
fi
77+
fi
5478
fi
5579
5680
# Determine base ref for comparison

0 commit comments

Comments
 (0)