-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (52 loc) · 1.83 KB
/
frontend-pr-deadline-slack-bot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Notify Pull Request Deadline (FE)
on:
pull_request:
types:
- opened
branches: ['dev']
paths:
- 'frontend/**'
jobs:
pull_request_open:
runs-on: ubuntu-latest
name: New pr to repo
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Remove "https://" from PR URL
id: remove_https
run: |
PR_URL="${{ github.event.pull_request.html_url }}"
PR_URL="http://${PR_URL#https://}"
echo "::set-output name=pr_url::$PR_URL"
- name: Set environment variable
run: echo "PR_CREATED_AT_UTC=${{ github.event.pull_request.created_at }}" >> $GITHUB_ENV
- name: Convert UTC to KST
run: |
UTC_TIME=$PR_CREATED_AT_UTC
KST_TIME=$(date -u -d "$UTC_TIME 9 hour" "+%Y-%m-%dT%H:%M:%SZ")
echo "PR_CREATED_AT_KST=$KST_TIME" >> $GITHUB_ENV
- name: Calculate deadline
id: deadline
run: node .github/workflows/scripts/calculatePRDeadline.js
env:
PR_CREATED_AT_KST: ${{ env.PR_CREATED_AT_KST }}
- name: Send Slack notification When FE PR
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_FE_CHANNEL }} # Slack 채널 ID
payload: |
{
"text": "",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ steps.remove_https.outputs.pr_url }}|${{ github.event.pull_request.title }}>\n코드리뷰 마감시간: ${{ steps.deadline.outputs.DEADLINE }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }} # Slack 토큰