-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (34 loc) · 1.27 KB
/
create-tag.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: OpenIM Create Tag
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
create-tag:
if: startsWith(github.event.comment.body, '/create tag')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Git user
run: |
git config user.name "kubbot" # 将 "Your Name" 替换为您想要使用的名字
git config user.email "[email protected]" # 将 "[email protected]" 替换为您想要使用的邮箱地址
- name: Create Tag
run: |
COMMENT_BODY="${{ github.event.comment.body }}"
TAG=$(echo $COMMENT_BODY | awk '{print $3}')
COMMENT=$(echo $COMMENT_BODY | awk '{$1=$2=$3=""; print $0}')
COMMENT=$(echo $COMMENT | sed 's/^ *//;s/ *$//') # Remove leading and trailing whitespaces
if [[ -z "$TAG" || -z "$COMMENT" ]]; then
echo "Error: Tag name or comment is empty"
exit 1
fi
echo "Creating tag $TAG with comment '$COMMENT'"
git config user.name "kubbot"
git config user.email "[email protected]"
git tag -a $TAG -m "$COMMENT"
git push origin $TAG
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}