From 583a2e011685291b2d0633639c7862ecd963e426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=A4=80=ED=97=8C?= Date: Thu, 13 Feb 2025 09:05:37 +0900 Subject: [PATCH 1/2] Add guide for testing GitHub Actions. This commit introduces a new markdown file, `github --- guide/github-action-test.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 guide/github-action-test.md diff --git a/guide/github-action-test.md b/guide/github-action-test.md new file mode 100644 index 0000000..8cda456 --- /dev/null +++ b/guide/github-action-test.md @@ -0,0 +1,2 @@ +# Github Action Test + From 22821c61a121285159a5526b1b094969d4e04292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=A4=80=ED=97=8C?= Date: Thu, 13 Feb 2025 10:28:44 +0900 Subject: [PATCH 2/2] Refactor Slack notification workflow for better user details Revised the Slack notification to include the GitHub user's full name when available. Added a step to fetch and use the name, with a fallback to the username. Improved message formatting for clarity and readability. --- .../workflows/notify-slack-on-pr-merge.yaml | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/notify-slack-on-pr-merge.yaml b/.github/workflows/notify-slack-on-pr-merge.yaml index 144c501..fa746d0 100644 --- a/.github/workflows/notify-slack-on-pr-merge.yaml +++ b/.github/workflows/notify-slack-on-pr-merge.yaml @@ -8,17 +8,26 @@ jobs: notify: runs-on: ubuntu-latest steps: - - name: Check if PR was merged + - name: Get GitHub User Name + id: get_username + run: | + USERNAME=$(curl -s "https://api.github.com/users/${{ github.actor }}" | jq -r '.name') + if [ "$USERNAME" == "null" ]; then + USERNAME="${{ github.actor }}" + fi + echo "USERNAME=$USERNAME" >> $GITHUB_ENV + + - name: Send Slack Notification if: github.event.pull_request.merged == true uses: rtCamp/action-slack-notify@v2 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_MESSAGE: | - ✅ PR Merged! - 🔗 Repository: `${{ github.repository }}` - 🛠 Merged by: `${{ github.actor }}` - 🚀 PR Title: `${{ github.event.pull_request.title }}` - 📝 PR Description: `${{ github.event.pull_request.body }}` - 🔗 PR URL: ${{ github.event.pull_request.html_url }} + ✅ *PR Merged!* + 🚀 *${{ github.event.pull_request.title }}* + 🛠 Merged by: `${{ env.USERNAME }}` + 📝 Description: + - ${{ github.event.pull_request.body }} + 🔗 *PR URL:* ${{ github.event.pull_request.html_url }} SLACK_USERNAME: "GitHub Actions" SLACK_ICON_EMOJI: ":white_check_mark:"