|
8 | 8 | notify:
|
9 | 9 | runs-on: ubuntu-latest
|
10 | 10 | steps:
|
11 |
| - - name: Set reviewers based on repository |
| 11 | + - name: Set reviewers based on branch |
12 | 12 | id: set-reviewers
|
13 | 13 | run: |
|
14 |
| - REPO_NAME="${{ github.repository }}" |
15 |
| - if [[ $REPO_NAME == *"dev-fe"* ]]; then |
| 14 | + TARGET_BRANCH="${{ github.event.pull_request.base.ref }}" |
| 15 | + if [[ $TARGET_BRANCH == "dev-fe" ]]; then |
16 | 16 | echo "team=FE" >> $GITHUB_OUTPUT
|
17 | 17 | echo "reviewers=<@U07GSBHPCPR> <@U07H6QLFPBM> <@U07H9CTPC9J>" >> $GITHUB_OUTPUT
|
18 | 18 | echo "reviewer_names=김지수, 고민지, 홍창현" >> $GITHUB_OUTPUT
|
19 |
| - elif [[ $REPO_NAME == *"dev-be"* ]]; then |
| 19 | + elif [[ $TARGET_BRANCH == "dev-be" ]]; then |
20 | 20 | echo "team=BE" >> $GITHUB_OUTPUT
|
21 | 21 | echo "reviewers=<@U07GSBPT9ST> <@U07H0978N14>" >> $GITHUB_OUTPUT
|
22 | 22 | echo "reviewer_names=김영길, 김준서" >> $GITHUB_OUTPUT
|
23 |
| - else |
24 |
| - echo "team=Team" >> $GITHUB_OUTPUT |
25 |
| - echo "reviewers=@here" >> $GITHUB_OUTPUT |
26 |
| - echo "reviewer_names=전체" >> $GITHUB_OUTPUT |
27 | 23 | fi
|
28 | 24 |
|
| 25 | + - name: Process PR title and body |
| 26 | + id: pr_process |
| 27 | + run: | |
| 28 | + # PR 제목 처리 |
| 29 | + title='${{ github.event.pull_request.title }}' |
| 30 | + title="${title//'"'/'\\"'}" |
| 31 | + echo "title=${title}" >> $GITHUB_OUTPUT |
| 32 | +
|
| 33 | + # PR 내용 처리 |
| 34 | + body='${{ github.event.pull_request.body }}' |
| 35 | + # Remove HTML comments and their content |
| 36 | + body=$(echo "$body" | sed 's/<!--.*-->//g') |
| 37 | + # Remove empty lines and special characters |
| 38 | + body=$(echo "$body" | grep -v '^$' | tr -d '\r') |
| 39 | + # Replace newlines with actual newlines in Slack message |
| 40 | + body=$(echo "$body" | tr '\n' ' ') |
| 41 | + echo "body=${body}" >> $GITHUB_OUTPUT |
| 42 | +
|
29 | 43 | - name: Send Slack notification
|
30 | 44 | uses: 8398a7/action-slack@v3
|
31 | 45 | with:
|
@@ -57,14 +71,14 @@ jobs:
|
57 | 71 | "type": "section",
|
58 | 72 | "text": {
|
59 | 73 | "type": "mrkdwn",
|
60 |
| - "text": "*PR 제목:*\n<${{ github.event.pull_request.html_url }}|${{ toJSON(github.event.pull_request.title) }}>" |
| 74 | + "text": "*PR 제목:*\n<${{ github.event.pull_request.html_url }}|${{ steps.pr_process.outputs.title }}>" |
61 | 75 | }
|
62 | 76 | },
|
63 | 77 | {
|
64 | 78 | "type": "section",
|
65 | 79 | "text": {
|
66 | 80 | "type": "mrkdwn",
|
67 |
| - "text": "*PR 설명:*\n${{ toJSON(github.event.pull_request.body) }}" |
| 81 | + "text": "*PR 설명:*\n${{ steps.pr_process.outputs.body }}" |
68 | 82 | }
|
69 | 83 | },
|
70 | 84 | {
|
|
0 commit comments