File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,17 +17,20 @@ jobs:
1717 ISSUE_NUMBER : ${{ github.event.issue.number }}
1818 REPO : ${{ github.repository }}
1919 run : |
20+ # Extract /kind values from issue body. Absence of a directive is a no-op
21+ # to avoid wiping kind/* labels set by maintainers through the UI.
22+ kinds=$(printf '%s' "$ISSUE_BODY" | tr -d '\r' | sed -n 's|^/kind[[:space:]][[:space:]]*||p' | sed 's|[[:space:]]*$||' | sed '/^$/d' | sort -u)
23+ [ -z "$kinds" ] && exit 0
24+
2025 # Remove existing kind/* labels
2126 gh issue view "$ISSUE_NUMBER" --repo "$REPO" --json labels \
2227 -q '.labels[].name | select(startswith("kind/"))' | \
2328 while IFS= read -r label; do
2429 gh issue edit "$ISSUE_NUMBER" --repo "$REPO" --remove-label "$label" || echo "::warning::Failed to remove label '$label'"
2530 done
2631
27- # Extract /kind values from issue body and apply labels
28- printf '%s' "$ISSUE_BODY" | tr -d '\r' | sed -n 's|^/kind[[:space:]][[:space:]]*||p' | sed 's|[[:space:]]*$||' | sort -u | \
32+ printf '%s\n' "$kinds" | \
2933 while IFS= read -r kind; do
30- [ -z "$kind" ] && continue
3134 gh issue edit "$ISSUE_NUMBER" --repo "$REPO" --add-label "kind/$kind" || \
3235 echo "::warning::Label 'kind/$kind' not found in repository"
3336 done
You can’t perform that action at this time.
0 commit comments