-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.35 KB
/
pr-merged.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Hacktoberfest PR Comment
on:
pull_request:
types:
- closed
jobs:
hacktoberfest-pr-comment:
runs-on: ubuntu-latest
steps:
- name: Check for Hacktoberfest label
id: check-label
uses: actions/labeler@v4
with:
label: hacktoberfest-accepted
action: exists
repo-token: ${{ secrets.GH_ACTIONS }}
- name: Debug outputs
run: |
echo "Actions: ${{ secrets.GH_ACTIONS }}"
echo "Label exists: ${{ steps.check-label.outputs.exists }}"
echo "PR merged: ${{ github.event.pull_request.merged }}"
echo "PR number: ${{ github.event.pull_request.number }}"
echo "PR author: ${{ github.event.pull_request.user.login }}"
- name: Comment on Hacktoberfest PR
if: steps.check-label.outputs.exists == 'true' && github.event.pull_request.merged == true
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
COMMENT_BODY="Congratulations @${PR_AUTHOR} on your Hacktoberfest PR! 🎉\n\n![Hacktoberfest Badge](./badges/hacktoberfest-badge.png)"
# Set up the GitHub CLI
GITHUB_TOKEN="${{ secrets.GH_ACTIONS }}"
echo "$COMMENT_BODY" | gh pr comment $PR_NUMBER -R $GITHUB_REPOSITORY --token $GITHUB_TOKEN