Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR 코드 분석 시 suggestion 태그를 위한 로직 추가 #744

Closed
wants to merge 30 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
53faac0
ci: suggestion 라벨에 대한 슬랙 메시지 로직 추가
JJ503 Nov 9, 2023
4878c0a
ci: 여러 jobs를 하나의 jobs로 합침
JJ503 Nov 9, 2023
b8f8bde
ci: 슬랙 메시지 테스트를 위한 로직 수정
JJ503 Nov 9, 2023
82b7c9b
ci: 각 step의 조건 수정
JJ503 Nov 9, 2023
3fab6cc
ci: 아이디에 대한 로직 수정
JJ503 Nov 9, 2023
4100389
ci: step의 조건 수정
JJ503 Nov 9, 2023
24f435d
ci: step들의 조건 수정
JJ503 Nov 9, 2023
d8b5028
ci: 조건 수정
JJ503 Nov 9, 2023
86ce87d
ci: 검증 수정
JJ503 Nov 9, 2023
fad355e
ci: 조건 추가
JJ503 Nov 9, 2023
bc128cd
ci: 조건 수정
JJ503 Nov 9, 2023
31dc2b4
ci: 조건 수정
JJ503 Nov 9, 2023
054b177
ci: 테스트를 위한 수정
JJ503 Nov 9, 2023
488953c
ci: 조건 수정
JJ503 Nov 9, 2023
515cbdc
ci: id 네이밍 수정
JJ503 Nov 9, 2023
339af21
ci: 테스트 로직 추가
JJ503 Nov 9, 2023
13855a8
ci
JJ503 Nov 9, 2023
765a3cf
ci: 조건 수정
JJ503 Nov 9, 2023
9d88721
ci: 테스트 로직 제거
JJ503 Nov 9, 2023
7ae143b
ci: 누락된 설정 추가
JJ503 Nov 9, 2023
6991f8f
ci: 첫 pr 요청 시에만 메시지를 보내도록 수정
JJ503 Nov 9, 2023
00b62bb
ci: 제안 pr 슬랙 메시지 workflow 분리
JJ503 Nov 9, 2023
d92a349
ci: 기존 코드 롤백 및 suggestion 라벨 제외 조건 추가
JJ503 Nov 9, 2023
4ffd184
ci: 테스트를 위한 로직 수정
JJ503 Nov 9, 2023
9153acd
ci: 테스트를 위한 로직 수정
JJ503 Nov 9, 2023
4475f35
ci: 테스트를 위한 수정 사항 제거
JJ503 Nov 9, 2023
ac91b5f
ci: 테스트를 위한 수정 사항 제거
JJ503 Nov 9, 2023
9e988b9
ci: 슬랙 메시지 형식 수정 및 강제 실패 추가
JJ503 Dec 8, 2023
ed7f9fa
ci: 슬랙 channel 호출이 안 되는 문제 해결
JJ503 Dec 8, 2023
3dbe997
ci: 첫 pr 요청 시에만 슬랙 알림이 가도록 수정
JJ503 Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 49 additions & 27 deletions .github/workflows/backend_pr_decorator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,53 @@ on:
permissions: write-all

jobs:
author-info:
runs-on: ubuntu-latest
outputs:
AUTHOR_NAME: ${{ steps.set-author-slack-id.outputs.AUTHOR_NAME }}
AUTHOR_ID: ${{ steps.set-author-slack-id.outputs.AUTHOR_ID }}
steps:
- name: set-author-slack-id
if: always()
id: author-slack
run: |
if [ "$GIT_ID" == "apptie" ]; then
AUTHOR_NAME="${{ secrets.apptie_slack_display_name }}"
AUTHOR_ID="${{ secrets.apptie_slack_id }}"
elif [ "$GIT_ID" == "swonny" ]; then
AUTHOR_NAME="${{ secrets.swonny_slack_display_name }}"
AUTHOR_ID="${{ secrets.swonny_slack_id }}"
elif [ "$GIT_ID" == "JJ503" ]; then
AUTHOR_NAME="${{ secrets.JJ503_slack_display_name }}"
AUTHOR_ID="${{ secrets.JJ503_slack_id }}"
elif [ "$GIT_ID" == "kwonyj1022" ]; then
AUTHOR_NAME="${{ secrets.kwonyj1022_slack_display_name }}"
AUTHOR_ID="${{ secrets.kwonyj1022_slack_id }}"
fi

echo "::set-output name=AUTHOR_NAME::${AUTHOR_NAME}"
echo "::set-output name=AUTHOR_ID::${AUTHOR_ID}"

suggestion:
if: contains(github.event.pull_request.labels.*.name, 'backend') && contains(github.event.pull_request.labels.*.name, 'suggestion')
runs-on: ubuntu-latest
steps:
- name: slack suggestion notification
if: github.event_name == 'pull_request' && github.event.action != 'synchronize'
run: |
SLACK_MESSAGE='{"text":"제안 PR","blocks":[{"type":"section","text":{"type":"mrkdwn","text":">*제안 PR* \n>\n>*PR Author*\n>'
SLACK_MESSAGE+="${{ needs.author-info.outputs.AUTHOR_NAME }}"
SLACK_MESSAGE+="\n>\n>*PR 링크*\n><"
SLACK_MESSAGE+="${{ github.event.pull_request.html_url }} "
SLACK_MESSAGE+="> \n>\n>*PR 제목*\n>"
SLACK_MESSAGE+="${{ github.event.pull_request.title }}"
SLACK_MESSAGE+="\n\n제안 사항에 대한 PR입니다.\n리뷰 요청은 스레드로 직접 멘션해주세요."
SLACK_MESSAGE+='"}}]}'

curl -X POST ${{ secrets.SLACK_WEBHOOK }} -d "${SLACK_MESSAGE}"

build:
if: contains(github.event.pull_request.labels.*.name, 'backend')
if: contains(github.event.pull_request.labels.*.name, 'backend') && !contains(github.event.pull_request.labels.*.name, 'suggestion')
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -38,34 +83,11 @@ jobs:
cd backend/ddang
./gradlew jacocoTestCoverage

- name: set author slack id
if: always()
id: author-slack
run: |
GIT_ID=${{ github.event.pull_request.user.login }}

if [ "$GIT_ID" == "apptie" ]; then
AUTHOR_NAME="${{ secrets.apptie_slack_display_name }}"
AUTHOR_ID="${{ secrets.apptie_slack_id }}"
elif [ "$GIT_ID" == "swonny" ]; then
AUTHOR_NAME="${{ secrets.swonny_slack_display_name }}"
AUTHOR_ID="${{ secrets.swonny_slack_id }}"
elif [ "$GIT_ID" == "JJ503" ]; then
AUTHOR_NAME="${{ secrets.JJ503_slack_display_name }}"
AUTHOR_ID="${{ secrets.JJ503_slack_id }}"
elif [ "$GIT_ID" == "kwonyj1022" ]; then
AUTHOR_NAME="${{ secrets.kwonyj1022_slack_display_name }}"
AUTHOR_ID="${{ secrets.kwonyj1022_slack_id }}"
fi

echo "AUTHOR_NAME=${AUTHOR_NAME}" >> $GITHUB_OUTPUT
echo "AUTHOR_ID=${AUTHOR_ID}" >> $GITHUB_OUTPUT

- name: slack notification
if: github.event_name == 'pull_request' && github.event.action != 'synchronize'
run: |
SLACK_MESSAGE='{"text":"PR 브랜치 분석","blocks":[{"type":"section","text":{"type":"mrkdwn","text":">*PR 브랜치 분석* \n>\n>*PR Author*\n>'
SLACK_MESSAGE+="${{ steps.author-slack.outputs.AUTHOR_NAME }}"
SLACK_MESSAGE+="${{ needs.author-info.outputs.AUTHOR_NAME }}"
SLACK_MESSAGE+="\n>\n>*PR 링크*\n><"
SLACK_MESSAGE+="${{ github.event.pull_request.html_url }} "
SLACK_MESSAGE+="> \n>\n>*PR 제목*\n>"
Expand All @@ -82,7 +104,7 @@ jobs:
run: |
SLACK_MESSAGE='{"text":"PR 브랜치 분석","blocks":[{"type":"section","text":{"type":"mrkdwn","text":">*PR 브랜치 분석* \n>\n>*PR Author*\n>'
SLACK_MESSAGE+="<@"
SLACK_MESSAGE+="${{ steps.author-slack.outputs.AUTHOR_ID }}"
SLACK_MESSAGE+="${{ needs.author-info.outputs.AUTHOR_ID }}"
SLACK_MESSAGE+=">"
SLACK_MESSAGE+="\n>\n>*PR 링크*\n><"
SLACK_MESSAGE+="${{ github.event.pull_request.html_url }} "
Expand All @@ -100,7 +122,7 @@ jobs:
run: |
SLACK_MESSAGE='{"text":"PR 브랜치 분석","blocks":[{"type":"section","text":{"type":"mrkdwn","text":">*PR 브랜치 분석* \n>\n>*PR Author*\n>'
SLACK_MESSAGE+="<@"
SLACK_MESSAGE+="${{ steps.author-slack.outputs.AUTHOR_ID }}"
SLACK_MESSAGE+="${{ needs.author-info.outputs.AUTHOR_ID }}"
SLACK_MESSAGE+=">"
SLACK_MESSAGE+="\n>\n>*PR 링크*\n><"
SLACK_MESSAGE+="${{ github.event.pull_request.html_url }} "
Expand Down
Loading