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 태그를 위한 로직 추가 #765

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/backend_pr_decorator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions: write-all

jobs:
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 @@ -112,3 +112,4 @@ jobs:
SLACK_MESSAGE+='"}}]}'

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

52 changes: 52 additions & 0 deletions .github/workflows/backend_suggestion_pr_decorator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 제안 PR 슬랙 메시지

on:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [ main, develop, develop-be ]

permissions: write-all

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

steps:
- uses: actions/checkout@v3

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

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

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

- name: slack suggestion notification
if: 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+="\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>*리뷰어*\n>"
SLACK_MESSAGE+="<!channel>"
SLACK_MESSAGE+='"}}]}'

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

- name: Force failure
run: exit 1

Loading