Skip to content

Commit

Permalink
fix: pr-slack-notify.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jsk3342 authored Nov 13, 2024
1 parent 07745fe commit d38180a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/pr-slack-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,18 @@ jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Set reviewers based on repository
- name: Set reviewers based on branch
id: set-reviewers
run: |
REPO_NAME="${{ github.repository }}"
if [[ $REPO_NAME == *"dev-fe"* ]]; then
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
if [[ $TARGET_BRANCH == "dev-fe" ]]; then
echo "team=FE" >> $GITHUB_OUTPUT
echo "reviewers=<@U07GSBHPCPR> <@U07H6QLFPBM> <@U07H9CTPC9J>" >> $GITHUB_OUTPUT
echo "reviewer_names=김지수, 고민지, 홍창현" >> $GITHUB_OUTPUT
elif [[ $REPO_NAME == *"dev-be"* ]]; then
elif [[ $TARGET_BRANCH == "dev-be" ]]; then
echo "team=BE" >> $GITHUB_OUTPUT
echo "reviewers=<@U07GSBPT9ST> <@U07H0978N14>" >> $GITHUB_OUTPUT
echo "reviewer_names=김영길, 김준서" >> $GITHUB_OUTPUT
else
echo "team=Team" >> $GITHUB_OUTPUT
echo "reviewers=@here" >> $GITHUB_OUTPUT
echo "reviewer_names=전체" >> $GITHUB_OUTPUT
fi
- name: Process PR title and body
Expand All @@ -36,10 +32,12 @@ jobs:
# PR 내용 처리
body='${{ github.event.pull_request.body }}'
body="${body//'%'/'%25'}"
body="${body//$'\n'/'\\n'}"
body="${body//$'\r'/'\\r'}"
body="${body//'"'/'\\"'}"
# Remove HTML comments and their content
body=$(echo "$body" | sed 's/<!--.*-->//g')
# Remove empty lines and special characters
body=$(echo "$body" | grep -v '^$' | tr -d '\r')
# Replace newlines with actual newlines in Slack message
body=$(echo "$body" | tr '\n' ' ')
echo "body=${body}" >> $GITHUB_OUTPUT
- name: Send Slack notification
Expand Down

0 comments on commit d38180a

Please sign in to comment.