Skip to content

Commit

Permalink
Update AddPRComment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzelin007 committed Nov 17, 2024
1 parent fa7a447 commit 6316ac2
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/AddPRComment.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
on:
pull_request_target:
types: [opened]
branches:
- dev
- release

permissions: {}
permissions:
pull-requests: write

jobs:
thank-user:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Say thanks for the PR
steps:
- name: Comment on PR
- name: get message
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
REPO_TOKEN: ${{ secrets.CLI_BOT }}
TITLE: ${{ github.event.pull_request.title }}
run: |
message='Thank you for your contribution! We will review the pull request and get back to you soon.'
# Comment on the PR using GitHub API
curl -X POST \
-H "Authorization: token $REPO_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPO/issues/$PR_NUMBER/comments \
-d "{\"body\": \"$message\"}"
pwd
message=$(echo "$TITLE" | grep -oP '[{\[][^}\]]+[}\]]' | sed 's/{\|}\|\[\|\]//g')
echo "Message to be posted: $message end."
echo "message=$message" >> $GITHUB_ENV

0 comments on commit 6316ac2

Please sign in to comment.