diff --git a/.github/memberMap.json b/.github/memberMap.json new file mode 100644 index 00000000..dc451241 --- /dev/null +++ b/.github/memberMap.json @@ -0,0 +1,22 @@ +{ + "seong-jin-jo": { + "name": "조성진", + "slackId": "U07V0TY7CF9" + }, + "dongjooyun": { + "name": "윤동주", + "slackId": "U09KJ5DTD2B" + }, + "Hyeonjun0527": { + "name": "최현준", + "slackId": "U08298MKCBE" + }, + "HA-SEUNG-JEONG": { + "name": "정하승", + "slackId": "U0A6HD2AB0E" + }, + "solvedacuser": { + "name": "노정환", + "slackId": "U0A6NRTGK2Q" + } +} \ No newline at end of file diff --git a/.github/workflows/notify-pr-author-on-review.yml b/.github/workflows/notify-pr-author-on-review.yml index 9f60a07c..2946c441 100644 --- a/.github/workflows/notify-pr-author-on-review.yml +++ b/.github/workflows/notify-pr-author-on-review.yml @@ -9,10 +9,11 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Extract Slack IDs and DM Text id: extract_info - env: - MEMBER_INFO: ${{ secrets.MEMBER_INFO_MAP }} run: | PR_AUTHOR="${{ github.event.pull_request.user.login }}" REVIEWER="${{ github.event.review.user.login }}" @@ -26,10 +27,11 @@ jobs: exit 0 fi - echo "$MEMBER_INFO" | base64 --decode > memberMap.json - AUTHOR_SLACK_ID=$(jq -r --arg id "$PR_AUTHOR" '.[$id].slackId' memberMap.json) - REVIEWER_SLACK_ID=$(jq -r --arg id "$REVIEWER" '.[$id].slackId' memberMap.json) + # 코드베이스의 memberMap.json에서 Slack ID 조회 + AUTHOR_SLACK_ID=$(jq -r --arg id "$PR_AUTHOR" '.[$id].slackId // empty' .github/memberMap.json) + REVIEWER_SLACK_ID=$(jq -r --arg id "$REVIEWER" '.[$id].slackId // empty' .github/memberMap.json) + # slackId가 없으면 DM 전송 불가 (skip) if [ -z "$AUTHOR_SLACK_ID" ] || [ -z "$REVIEWER_SLACK_ID" ] || \ [ "$AUTHOR_SLACK_ID" = "null" ] || [ "$REVIEWER_SLACK_ID" = "null" ]; then echo "skip=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/notify-slack-on-pr-opened.yml b/.github/workflows/notify-slack-on-pr-opened.yml index 9a67acf0..0d1f67a2 100644 --- a/.github/workflows/notify-slack-on-pr-opened.yml +++ b/.github/workflows/notify-slack-on-pr-opened.yml @@ -13,19 +13,29 @@ jobs: runs-on: ubuntu-latest steps: - - name: Decode memberMap.json from secret - run: | - echo "${{ secrets.MEMBER_INFO_MAP }}" | base64 --decode > memberMap.json + - name: Checkout + uses: actions/checkout@v4 + - name: Get PR author and reviewers id: get_member_info run: | # PR 작성자 이름 추출 PR_AUTHOR_GITHUB_ID="${{ github.event.pull_request.user.login }}" - PR_AUTHOR_NAME=$(jq -r --arg id "$PR_AUTHOR_GITHUB_ID" '.[$id].name' memberMap.json) + PR_AUTHOR_NAME=$(jq -r --arg id "$PR_AUTHOR_GITHUB_ID" '.[$id].name // "알 수 없음"' .github/memberMap.json) echo "pr_author_name=$PR_AUTHOR_NAME" >> $GITHUB_OUTPUT - # PR 작성자 제외한 멤버들의 slackId를 멘션으로 모으기 - MENTIONS=$(jq -r --arg author "$PR_AUTHOR_GITHUB_ID" 'to_entries | map(select(.key != $author)) | map("<@" + .value.slackId + ">") | join(" ")' memberMap.json) + # PR 작성자 제외한 멤버들의 slackId를 멘션으로 모으기 (slackId가 있는 경우만) + MENTIONS=$(jq -r --arg author "$PR_AUTHOR_GITHUB_ID" ' + to_entries + | map(select(.key != $author and .value.slackId != null and .value.slackId != "")) + | map("<@" + .value.slackId + ">") + | join(" ") + ' .github/memberMap.json) + + # 멘션이 없으면 빈 문자열로 설정 + if [ -z "$MENTIONS" ] || [ "$MENTIONS" = "null" ]; then + MENTIONS="" + fi echo "reviewers_mention=$MENTIONS" >> $GITHUB_OUTPUT - name: Send Slack message diff --git a/src/components/payment/paymentActionClient.tsx b/src/components/payment/paymentActionClient.tsx index 12a4accb..44df25fb 100644 --- a/src/components/payment/paymentActionClient.tsx +++ b/src/components/payment/paymentActionClient.tsx @@ -116,8 +116,21 @@ export default function PaymentCheckoutPage({ study }: Props) { // 회원 결제 // @docs https://docs.tosspayments.com/sdk/v2/js#tosspaymentspayment + // customerKey 형식: 영문 대소문자, 숫자, 특수문자 -, _, =, ., @로 2자 이상 50자 이하 + // memberId를 안전한 형식으로 변환 (예: 기존 123 -> 변경 후 member-123) + const customerKey = `member-${study.memberId}`.replace( + /[^a-zA-Z0-9\-_=.@]/g, + '', + ); + + // Toss 에서 2자이상 50자이하 문자열을 요구함 + if (customerKey.length < 2 || customerKey.length > 50) { + throw new Error( + `customerKey가 유효하지 않습니다: ${customerKey} (길이: ${customerKey.length})`, + ); + } const payment = tossPayments.payment({ - customerKey: String(study.memberId), + customerKey, }); setPayment(payment);