구글 태그 및 채널톡 버튼 추가, 코드리뷰 마감시간 알림 슬랙봇 구현 #2
Workflow file for this run
This file contains 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: Notify Pull Request Deadline | |
on: | |
pull_request: | |
types: | |
- opened | |
branches: ['dev'] | |
paths: | |
- 'backend/**' | |
- '.github/**' | |
defaults: | |
run: | |
working-directory: backend | |
jobs: | |
pull_request_open: | |
runs-on: ubuntu-latest | |
name: New pr to repo | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- 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 BE PR | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ secrets.SLACK_BE_CHANNEL }} # Slack 채널 ID | |
payload: | | |
{ | |
"text": "", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>\n코드리뷰 마감시간:${{ steps.deadline.outputs.DEADLINE }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }} # Slack 토큰 |