Skip to content

Commit

Permalink
Update create-tag.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw authored Nov 3, 2023
1 parent 32f6eeb commit a6d4bca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/create-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- 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 "GitHub Action"
git config user.email "action@github.com"
git tag -a $TAG -m "$COMMENT"
git push origin $TAG
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a6d4bca

Please sign in to comment.