Skip to content

Commit 4bb3a06

Browse files
authored
Merge pull request #344 from Asymtode712/patch-5
Create autocomment-pr-raise.yml
2 parents da7c769 + f12be63 commit 4bb3a06

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Auto Comment on PR
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
10+
11+
jobs:
12+
comment:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
steps:
17+
- name: Add Comment to Pull Request
18+
run: |
19+
COMMENT=$(cat <<EOF
20+
{
21+
"body": "Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our [CONTRIBUTING.md](https://github.com/recodehive/Stackoverflow-Analysis/blob/main/CONTRIBUTING.md). If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊"
22+
}
23+
EOF
24+
)
25+
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
26+
-X POST \
27+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
28+
-H "Accept: application/vnd.github.v3+json" \
29+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
30+
-d "$COMMENT")
31+
cat response.json
32+
if [ "$RESPONSE" -ne 201 ]; then
33+
echo "Failed to add comment"
34+
exit 1
35+
fi
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)