Skip to content

Resolved #374

Resolved #374 #80

name: Auto Comment on PR Open
on:
pull_request_target:
types: [opened]
permissions:
issues: write
pull-requests: write
jobs:
comment-on-open:
runs-on: ubuntu-latest
steps:
- name: Add Comment to Opened PR
run: |
COMMENT=$(cat <<EOF
{
"body": "👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly! \n\nFeel free to join our community on [Discord](https://discord.gg/9mZnkTRFFe) to discuss more!"
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment on PR open"
exit 1
fi
- name: Add Reviewer to Pull Request
run: |
REVIEWERS=$(cat <<EOF
{
"reviewers": ["mansiruhil13"]
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d "$REVIEWERS")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add reviewer"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}