feat : λμ€μ½λ webhook + ν΄λ‘λ.md μΆκ° #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Label Notify | |
| on: | |
| pull_request: | |
| types: [labeled] | |
| repository_dispatch: | |
| types: [pr_notify] | |
| jobs: | |
| notify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Send Discord notification for PR label | |
| if: github.event_name == 'pull_request' && github.event.label.name == 'need_review' | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| REPO_NAME: ${{ github.repository }} | |
| run: | | |
| TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ) | |
| jq -n \ | |
| --arg username "νλ‘ νΈ PR 리뷰λ΄" \ | |
| --arg avatar_url "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" \ | |
| --arg content "λ¦¬λ·°κ° νμν©λλ€! <@&1368737911301865503>" \ | |
| --arg pr_number "$PR_NUMBER" \ | |
| --arg pr_title "$PR_TITLE" \ | |
| --arg pr_author "$PR_AUTHOR" \ | |
| --arg pr_url "$PR_URL" \ | |
| --arg repo_name "$REPO_NAME" \ | |
| --arg timestamp "$TIMESTAMP" \ | |
| '{ | |
| username: $username, | |
| avatar_url: $avatar_url, | |
| content: $content, | |
| embeds: [{ | |
| title: ("PR #" + $pr_number + ": " + $pr_title), | |
| description: "리뷰 μμ²μ΄ μμ΅λλ€", | |
| url: $pr_url, | |
| color: 3447003, | |
| fields: [ | |
| { | |
| name: "μμ±μ", | |
| value: $pr_author, | |
| inline: true | |
| }, | |
| { | |
| name: "μ μ₯μ", | |
| value: $repo_name, | |
| inline: true | |
| } | |
| ], | |
| footer: { | |
| text: "GitHub Actions" | |
| }, | |
| timestamp: $timestamp | |
| }], | |
| allowed_mentions: { | |
| roles: ["1368737911301865503"] | |
| } | |
| }' | curl -X POST "$DISCORD_WEBHOOK_URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d @- | |
| - name: Send Discord notification for webhook | |
| if: github.event_name == 'repository_dispatch' | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| CUSTOM_MESSAGE: ${{ github.event.client_payload.message }} | |
| run: | | |
| MESSAGE="${CUSTOM_MESSAGE:-λ¦¬λ·°κ° νμν©λλ€! <@&1368737911301865503>}" | |
| jq -n \ | |
| --arg username "νλ‘ νΈ PR 리뷰λ΄" \ | |
| --arg avatar_url "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" \ | |
| --arg content "$MESSAGE" \ | |
| '{ | |
| username: $username, | |
| avatar_url: $avatar_url, | |
| content: $content, | |
| allowed_mentions: { | |
| roles: ["1368737911301865503"] | |
| } | |
| }' | curl -X POST "$DISCORD_WEBHOOK_URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d @- |