[CHORE] 이슈 테스트 #1
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: Discord notification on new issues | |
| on: | |
| issues: | |
| types: [opened, reopened] | |
| workflow_dispatch: | |
| jobs: | |
| notify-discord-issue: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Debug All Event Data | |
| run: echo '${{ toJson(github.event) }}' | |
| - name: Set Environment Variables | |
| env: | |
| TITLE: ${{ github.event.issue.title }} | |
| run: | | |
| echo "AVATAR_URL=${{ secrets.DISCORD_AVATAR_URL }}" >> $GITHUB_ENV | |
| echo "USERNAME=망곰" >> $GITHUB_ENV | |
| echo "CONTENT=새 이슈가 생겼어요!" >> $GITHUB_ENV | |
| echo "WEB_HOOK=${{ secrets.DISCORD_WEB_HOOK }}" >> $GITHUB_ENV | |
| - name: Notify Discord | |
| env: | |
| AUTHOR_NAME: ${{ github.event.issue.user.login }} | |
| ISSUE_URL: ${{ github.event.issue.html_url }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| AUTHOR_URL: ${{ github.event.issue.user.avatar_url }} | |
| AVATAR_URL: ${{ env.AVATAR_URL }} | |
| USERNAME: ${{ env.USERNAME }} | |
| WEB_HOOK: ${{ env.WEB_HOOK }} | |
| CONTENT: ${{ env.CONTENT }} | |
| run: | | |
| if [ -n "$WEB_HOOK" ]; then | |
| JSON_PAYLOAD=$(jq -n \ | |
| --arg content "$CONTENT" \ | |
| --arg username "$USERNAME" \ | |
| --arg avatar_url "$AVATAR_URL" \ | |
| --arg issue_title "$ISSUE_TITLE" \ | |
| --arg issue_url "$ISSUE_URL" \ | |
| --arg author_url "$AUTHOR_URL" \ | |
| --arg author_name "$AUTHOR_NAME" \ | |
| --arg color "5814783" \ | |
| --arg timestamp "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ | |
| '{ | |
| username: $username, | |
| avatar_url: $avatar_url, | |
| content: $content, | |
| embeds: [{ | |
| title: $issue_title, | |
| url: $issue_url, | |
| author: { | |
| name: $author_name, | |
| icon_url: $author_url | |
| }, | |
| color: ($color | tonumber), | |
| timestamp: $timestamp | |
| }] | |
| }') | |
| curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" "$WEB_HOOK" | |
| else | |
| echo "No matching title found. Skipping notification." | |
| fi |