Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{CI} Update AddPRComment.yml #30072

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .github/workflows/AddPRComment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@ on:
- dev
- release

permissions:
pull-requests: write
permissions: {}

jobs:
thank-user:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Say thanks for the PR
steps:
- name: get message
- name: Comment on PR
env:
TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
REPO_TOKEN: ${{ secrets.CLI_BOT }}
run: |
message=$(echo "$TITLE" | grep -oP '[{\[][^}\]]+[}\]]' | sed 's/{\|}\|\[\|\]//g')
echo "message=$message" >> $GITHUB_ENV
if [ -z $message ]; then
echo "message=$(echo 'Thank you for your contribution! We will review the pull request and get back to you soon.')" >> $GITHUB_ENV
fi
- name: comment on the pull request
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.CLI_BOT }}
message: "${{ env.message }}"
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\"}"
Loading