forked from StarRocks/starrocks-kubernetes-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] add more labels based on PR title (StarRocks#325)
Signed-off-by: yandongxiao <[email protected]>
- Loading branch information
1 parent
6256bdb
commit 5b05b87
Showing
2 changed files
with
36 additions
and
17 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,36 @@ | ||
#!/bin/bash | ||
|
||
# input parameters: a list of PR numbers and a version tag | ||
# e.g. v1.8.6 1 2 3 4 5 | ||
VERSION_TAG=$1 | ||
|
||
# create label by gh | ||
gh label create $VERSION_TAG | ||
|
||
shift | ||
PR_NUMBERS=("$@") | ||
|
||
# define an array of keywords | ||
KEYWORDS=("feature" "enhancement" "bugfix" "chore" "documentation") | ||
|
||
# iterate over the list of PR numbers | ||
for PR_NUMBER in "${PR_NUMBERS[@]}"; do | ||
# add a version label to each PR | ||
gh pr edit $PR_NUMBER --add-label "$VERSION_TAG" | ||
|
||
# get the PR title | ||
PR_TITLE=$(gh pr view $PR_NUMBER --json title -q '.title') | ||
|
||
# convert PR title to lowercase | ||
PR_TITLE=$(echo "$PR_TITLE" | tr '[:upper:]' '[:lower:]') | ||
|
||
# check if the PR title contains any of the keywords | ||
for KEYWORD in "${KEYWORDS[@]}"; do | ||
if [[ $PR_TITLE == *"$KEYWORD"* ]]; then | ||
# create the label if it doesn't exist | ||
gh label create $KEYWORD 2>/dev/null | ||
# add the label to the PR | ||
gh pr edit $PR_NUMBER --add-label "$KEYWORD" | ||
fi | ||
done | ||
done |
This file was deleted.
Oops, something went wrong.