Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Doeunnkimm committed Jun 25, 2024
1 parent 4d79513 commit 0a4c5b8
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/slack-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ jobs:
run: |
response=$(curl -X POST -H 'Content-type: application/json' --data '{
"text": "*πŸ§žβ€β™‚οΈ PR λ“œλ¦¬λŠ” μ§€λ‹ˆκ°€ μ™”μŠ΅λ‹ˆλ‹€~*\n*<${{ github.event.pull_request.html_url }}|[sambad#${{ github.event.pull_request.number }}] [${{ github.event.pull_request.title }}]>*\n${{ github.event.pull_request.user.login }}λ‹˜μ΄ μƒμ„±ν–ˆμ–΄μš”."
}' ${{ secrets.SLACK_BOT_ACCESS_TOKEN }})
echo "slack_ts=$(echo $response | jq -r '.ts')" >> $GITHUB_ENV
}' ${{ secrets.SLACK_WEBHOOK_URL }})
slack_ts=$(echo $response | jq -r '.ts')
echo "slack_ts=$slack_ts" >> $GITHUB_ENV
echo $slack_ts > slack_ts.txt
env:
SLACK_BOT_ACCESS_TOKEN: ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Send notification for review request
if: ${{ env.event_type == 'pull_request' && github.event.action == 'review_requested' }}
Expand All @@ -47,14 +48,15 @@ jobs:
if [ "$slack_username" != "null" ]; then
response=$(curl -X POST -H 'Content-type: application/json' --data '{
"text": "*πŸ”” 리뷰 μš”μ²­μ΄ λ„μ°©ν–ˆμŠ΅λ‹ˆλ‹€*: @'$slack_username'"
}' ${{ secrets.SLACK_BOT_ACCESS_TOKEN }})
echo "slack_ts=$(echo $response | jq -r '.ts')" >> $GITHUB_ENV
}' ${{ secrets.SLACK_WEBHOOK_URL }})
slack_ts=$(echo $response | jq -r '.ts')
echo "slack_ts=$slack_ts" >> $GITHUB_ENV
echo $slack_ts > slack_ts.txt
else
echo "Reviewer not found in mapping: $reviewer"
fi
env:
SLACK_BOT_ACCESS_TOKEN: ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Restore Slack message timestamp
if: ${{ env.event_type == 'issue_comment' || env.event_type == 'pull_request_review' }}
Expand All @@ -79,12 +81,12 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{
"text": "@'$slack_username'λ‹˜μ΄ μ½”λ©˜νŠΈλ₯Ό λ‹¬μ•˜μŠ΅λ‹ˆλ‹€ πŸ’Œ:\n${{ github.event.comment.body }}",
"thread_ts": "${{ env.SLACK_MESSAGE_TS }}"
}' ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
}' ${{ secrets.SLACK_WEBHOOK_URL }}
else
echo "Commenter not found in mapping: $commenter"
fi
env:
SLACK_BOT_ACCESS_TOKEN: ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Send notification for approval
if: ${{ env.event_type == 'pull_request_review' && github.event.review.state == 'approved' && env.SLACK_MESSAGE_TS != '' }}
Expand All @@ -95,9 +97,9 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{
"text": "βœ… @'$slack_username'λ‹˜μ΄ μŠΉμΈν•˜μ…¨μ–΄μš” πŸŽ‰",
"thread_ts": "${{ env.SLACK_MESSAGE_TS }}"
}' ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
}' ${{ secrets.SLACK_WEBHOOK_URL }}
else
echo "Reviewer not found in mapping: $reviewer"
fi
env:
SLACK_BOT_ACCESS_TOKEN: ${{ secrets.SLACK_BOT_ACCESS_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 0a4c5b8

Please sign in to comment.