diff --git a/.github/workflows/develop_build_deploy.yml b/.github/workflows/develop_build_deploy.yml index cb946a2..2365995 100644 --- a/.github/workflows/develop_build_deploy.yml +++ b/.github/workflows/develop_build_deploy.yml @@ -77,3 +77,29 @@ jobs: echo "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin docker compose up -d docker image prune -a -f + + # 슬랙으로 알림 전송 + - name: Send to slack notification + uses: slackapi/slack-github-action@v2.1.0 + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ secrets.SLACK_CHANNEL_ID }} + text: "Build and Deploy result" + blocks: + - type: section + text: + type: mrkdwn + text: "*✅ 배포 완료 알림*" + - type: section + text: + type: mrkdwn + text: "*실행 로그:* 🔗 <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>" + - type: context + elements: + - type: mrkdwn + text: "*브랜치:* `${{ github.ref_name }}`" + - type: mrkdwn + text: "*커밋:* `${{ github.sha }}`" + - type: divider \ No newline at end of file diff --git a/.github/workflows/develop_deploy.yml b/.github/workflows/develop_deploy.yml index 2343f05..b62d06d 100644 --- a/.github/workflows/develop_deploy.yml +++ b/.github/workflows/develop_deploy.yml @@ -32,4 +32,30 @@ jobs: script: | echo "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin docker compose up -d - docker image prune -a -f \ No newline at end of file + docker image prune -a -f + + # 슬랙으로 알림 전송 + - name: Send to slack notification + uses: slackapi/slack-github-action@v2.1.0 + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ secrets.SLACK_CHANNEL_ID }} + text: "Build and Deploy result" + blocks: + - type: section + text: + type: mrkdwn + text: "*✅ 배포 완료 알림*" + - type: section + text: + type: mrkdwn + text: "*실행 로그:* 🔗 <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>" + - type: context + elements: + - type: mrkdwn + text: "*브랜치:* `${{ github.ref_name }}`" + - type: mrkdwn + text: "*커밋:* `${{ github.event.inputs.commit_hash }}`" + - type: divider \ No newline at end of file diff --git a/.github/workflows/develop_pull_request.yml b/.github/workflows/develop_pull_request.yml index 1cb5ddc..1af5919 100644 --- a/.github/workflows/develop_pull_request.yml +++ b/.github/workflows/develop_pull_request.yml @@ -15,6 +15,7 @@ jobs: strategy: matrix: java-version: [ 17 ] + distribution: [ 'temurin' ] steps: - name: Checkout code @@ -24,7 +25,7 @@ jobs: uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} - distribution: 'temurin' + distribution: ${{ matrix.distribution }} - name: Run MySQL with Docker run: | @@ -47,3 +48,33 @@ jobs: - name: Run Gradle Check run: ./gradlew check + + # 슬랙으로 알림 전송 + - name: Send to slack notification + uses: slackapi/slack-github-action@v2.1.0 + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ secrets.SLACK_CHANNEL_ID }} + text: "PR event" + blocks: + - type: section + text: + type: mrkdwn + text: "${{ secrets.SLACK_GROUP_MENTION }}\n\n📌 *PR 이벤트 알림 (<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}>)*" + - type: section + text: + type: mrkdwn + text: "> PR 이벤트 알림입니다.\n> *최신 변경 사항 검토*, *코드 리뷰* 부탁드립니다." + - type: section + text: + type: mrkdwn + text: "*PR:* 🔗 <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>" + - type: context + elements: + - type: mrkdwn + text: "*브랜치:* `${{ github.head_ref }}` -> `${{ github.base_ref }}`" + - type: mrkdwn + text: "*작성자:* ${{ github.event.pull_request.user.login }}" + - type: divider diff --git a/.github/workflows/notify_pull_request_review.yml b/.github/workflows/notify_pull_request_review.yml new file mode 100644 index 0000000..949e611 --- /dev/null +++ b/.github/workflows/notify_pull_request_review.yml @@ -0,0 +1,56 @@ +name: pull request Review notify + +on: + pull_request_review: + types: [ "submitted" ] + +jobs: + notify_reveiw: + runs-on: ubuntu-latest + steps: + - name: Set review state + id: set-state + env: + REVIEW_STATE: ${{ github.event.review.state }} + PR_LINK: "<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}>" + SLACK_MENTION: ${{ secrets.SLACK_GROUP_MENTION }} + run: | + state="💬 *PR 코멘트 알림 ($PR_LINK)*" + + if [[ "$REVIEW_STATE" == "approved" ]]; then + state="$SLACK_MENTION\n\n✅ *PR 승인 알림 ($PR_LINK)*" + elif [[ "$REVIEW_STATE" == "changes_requested" ]]; then + state="$SLACK_MENTION\n\n🛠️ *PR 변경 요청 알림 ($PR_LINK)*" + fi + + echo "state=$state" >> $GITHUB_OUTPUT + + # 슬랙으로 알림 전송 + - name: Send to slack notification + uses: slackapi/slack-github-action@v2.1.0 + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ secrets.SLACK_CHANNEL_ID }} + text: "Add PR review" + blocks: + - type: section + text: + type: mrkdwn + text: "${{ steps.set-state.outputs.state }}" + - type: section + text: + type: mrkdwn + text: "> _${{ github.event.review.body }}_" + - type: section + text: + type: mrkdwn + text: "*PR:* 🔗 <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>" + - type: context + elements: + - type: mrkdwn + text: "*리뷰 상태:* `${{ github.event.review.state }}`" + - type: mrkdwn + text: "*리뷰어:* ${{ github.event.review.user.login }}" + - type: divider \ No newline at end of file