Sweep: Optimize the README to make it look professional or polished #8
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
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: 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 "[email protected]" | |
git tag -a $TAG -m "$COMMENT" | |
git push origin $TAG | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |