File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 4242 echo "pr-url=$PR_URL" >> $GITHUB_OUTPUT
4343 echo "PR Labels: $LABELS"
4444
45+ # Extract release labels and count them
46+ RELEASE_LABELS=$(echo "$LABELS" | grep -oE 'release:(major|minor|patch)' || true)
47+ # Count release labels (handle empty string case)
48+ if [ -z "$RELEASE_LABELS" ]; then
49+ LABEL_COUNT=0
50+ else
51+ LABEL_COUNT=$(echo "$RELEASE_LABELS" | wc -l | tr -d ' ')
52+ fi
53+
54+ # Safeguard: Fail if multiple release labels are present
55+ if [ "$LABEL_COUNT" -gt 1 ]; then
56+ echo "ERROR: Multiple release labels found:"
57+ echo "$RELEASE_LABELS" | sed 's/^/ - /'
58+ echo "Please use only ONE release label per PR: release:major, release:minor, or release:patch"
59+ exit 1
60+ fi
61+
62+ # Determine version bump based on single label (priority: major > minor > patch)
4563 if echo "$LABELS" | grep -q "release:major"; then
4664 echo "bump=major" >> $GITHUB_OUTPUT
4765 echo "should-release=true" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments