-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore:add a new workflow to mark new issues with need-triage label (#…
…22990) Signed-off-by: Valeriy Svydenko <[email protected]>
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Label New Issues | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
label-issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Add Label "status/need-triage" if no label starting with "severity" exists | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CHE_BOT_GITHUB_TOKEN }} | ||
run: | | ||
ISSUE_NUMBER=${{ github.event.issue.number }} | ||
REPO=${{ github.repository }} | ||
LABEL_TO_ADD="status/need-triage" | ||
LABEL_PREFIX="severity" | ||
# Get the issue labels | ||
ISSUE_LABELS=$(gh issue view $ISSUE_NUMBER --json labels --jq '.labels[].name') | ||
# Check if any label starts with 'severity' | ||
if echo "$ISSUE_LABELS" | grep -q "^$LABEL_PREFIX"; then | ||
echo "A label starting with '$LABEL_PREFIX' exists. No action needed." | ||
else | ||
echo "No label starting with '$LABEL_PREFIX' found. Adding '$LABEL_TO_ADD'." | ||
# Add the label to the issue | ||
gh issue edit $ISSUE_NUMBER --add-label "$LABEL_TO_ADD" | ||
fi |