Skip to content

Commit 904aca2

Browse files
authored
chore:add a new workflow to mark new issues with need-triage label (#22990)
Signed-off-by: Valeriy Svydenko <[email protected]>
1 parent ccb99a6 commit 904aca2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Label New Issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
label-issue:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Add Label "status/need-triage" if no label starting with "severity" exists
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.CHE_BOT_GITHUB_TOKEN }}
18+
run: |
19+
ISSUE_NUMBER=${{ github.event.issue.number }}
20+
REPO=${{ github.repository }}
21+
LABEL_TO_ADD="status/need-triage"
22+
LABEL_PREFIX="severity"
23+
# Get the issue labels
24+
ISSUE_LABELS=$(gh issue view $ISSUE_NUMBER --json labels --jq '.labels[].name')
25+
# Check if any label starts with 'severity'
26+
if echo "$ISSUE_LABELS" | grep -q "^$LABEL_PREFIX"; then
27+
echo "A label starting with '$LABEL_PREFIX' exists. No action needed."
28+
else
29+
echo "No label starting with '$LABEL_PREFIX' found. Adding '$LABEL_TO_ADD'."
30+
# Add the label to the issue
31+
gh issue edit $ISSUE_NUMBER --add-label "$LABEL_TO_ADD"
32+
fi

0 commit comments

Comments
 (0)