Skip to content
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
14 changes: 14 additions & 0 deletions .github/actions/setup-node-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup Node.js and pnpm
description: Node.js와 pnpm을 설치하고 pnpm 캐시를 설정합니다

runs:
using: composite
steps:
- name: pnpm 설치
uses: pnpm/action-setup@v4

- name: 노드 설치
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
10 changes: 2 additions & 8 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Node.js 및 pnpm 설치
uses: ./.github/actions/setup-node-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
61 changes: 40 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI - 빌드 및 린트 테스트
on: [pull_request]

jobs:
build-and-lint:
check-types:
if: |
github.actor == 'hyun907' ||
github.actor == 'hyun907' ||
github.actor == 'ssilver01'

runs-on: ubuntu-latest
Expand All @@ -14,36 +14,55 @@ jobs:
- name: 코드 체크아웃
uses: actions/checkout@v4

- name: pnpm 설치
uses: pnpm/action-setup@v4

- name: 노드 설치
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: 의존성 캐시
uses: actions/cache@v4
with:
path: |
**/node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Node.js 및 pnpm 설치
uses: ./.github/actions/setup-node-pnpm

- name: 의존성 설치
run: pnpm install
run: pnpm install --frozen-lockfile

- name: 타입 체크
run: pnpm check-types

lint:
if: |
github.actor == 'hyun907' ||
github.actor == 'ssilver01'

runs-on: ubuntu-latest

steps:
- name: 코드 체크아웃
uses: actions/checkout@v4

- name: Node.js 및 pnpm 설치
uses: ./.github/actions/setup-node-pnpm

- name: 의존성 설치
run: pnpm install --frozen-lockfile

- name: 린트 체크
run: pnpm lint

- name: 코드 포맷 체크
run: pnpm prettier

build:
if: |
github.actor == 'hyun907' ||
github.actor == 'ssilver01'

needs: [check-types, lint]
runs-on: ubuntu-latest

steps:
- name: 코드 체크아웃
uses: actions/checkout@v4

- name: Node.js 및 pnpm 설치
uses: ./.github/actions/setup-node-pnpm

- name: 의존성 설치
run: pnpm install --frozen-lockfile

- name: 빌드 실행
run: pnpm build
22 changes: 12 additions & 10 deletions .github/workflows/pr-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ jobs:

steps:
- name: Send Slack Notification
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
EVENT_NAME: ${{ github.event_name }}
REVIEW_STATE: ${{ github.event.review.state }}
REVIEWER: ${{ github.event.review.user.login }}
REQUESTED_REVIEWER: ${{ github.event.requested_reviewer.login }}
REQUESTED_TEAM: ${{ github.event.requested_team.name }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
PR_TITLE="${{ github.event.pull_request.title }}"
PR_URL="${{ github.event.pull_request.html_url }}"
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
EVENT_NAME="${{ github.event_name }}"

# GitHub 유저네임 -> Slack User ID 매핑
get_slack_user_id() {
Expand All @@ -36,21 +42,17 @@ jobs:
}

if [ "$EVENT_NAME" == "pull_request_review" ]; then
REVIEW_STATE="${{ github.event.review.state }}"
# approved일 때만 알림
if [ "$REVIEW_STATE" == "approved" ]; then
REVIEWER="${{ github.event.review.user.login }}"
PR_AUTHOR_SLACK_ID=$(get_slack_user_id "$PR_AUTHOR")
MESSAGE="✅ *PR 승인! 리뷰 확인하러 와주세요*\n\n<@${PR_AUTHOR_SLACK_ID}> *승인자:* ${REVIEWER}\n*제목:* ${PR_TITLE} (#${PR_NUMBER})\n*링크:* ${PR_URL}"
else
exit 0 # 코멘트나 변경요청은 알림 안 보냄
fi
else
# 리뷰 요청된 사람 정보 가져오기
REQUESTED_REVIEWER="${{ github.event.requested_reviewer.login }}"
if [ -z "$REQUESTED_REVIEWER" ]; then
# 팀이 요청된 경우
REQUESTED_TEAM="${{ github.event.requested_team.name }}"
MESSAGE="👀 *리뷰 요청!*\n\n*요청 대상:* @${REQUESTED_TEAM} 팀\n*제목:* ${PR_TITLE} (#${PR_NUMBER})\n*작성자:* ${PR_AUTHOR}\n*링크:* ${PR_URL}"
else
SLACK_USER_ID=$(get_slack_user_id "$REQUESTED_REVIEWER")
Expand All @@ -63,4 +65,4 @@ jobs:
--data "{
\"text\": \"${MESSAGE}\"
}" \
${{ secrets.SLACK_WEBHOOK_URL }}
"$SLACK_WEBHOOK"
17 changes: 7 additions & 10 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
vercel-preview:
if: |
github.actor == 'hyun907' ||
github.actor == 'hyun907' ||
github.actor == 'ssilver01'

runs-on: ubuntu-latest
Expand All @@ -20,17 +20,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: pnpm 설치
uses: pnpm/action-setup@v4
- name: Node.js 및 pnpm 설치
uses: ./.github/actions/setup-node-pnpm

- name: 노드 설치
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: 의존성 설치
run: pnpm install --frozen-lockfile

- name: Vercel CLI 설치
run: npm install --global vercel@latest
run: pnpm add -g vercel@latest

- name: Vercel 환경변수 가져오기
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
Expand All @@ -42,7 +39,7 @@ jobs:
id: deploy
run: |
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel-output.txt
echo "preview_url=$(cat vercel-output.txt)" >> $GITHUB_OUTPUT
echo "preview_url=$(cat vercel-output.txt)" >> "$GITHUB_OUTPUT"

- name: PR에 Preview URL 댓글 추가
uses: thollander/actions-comment-pull-request@v2
Expand Down
Loading