✨ feat: d #101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI (PR to dev) | |
| on: | |
| pull_request: | |
| branches: | |
| - dev | |
| jobs: | |
| ci: | |
| name: Lint / Type / Test / Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run ESLint | |
| run: yarn lint | |
| - name: Type check | |
| run: yarn type-check | |
| - name: Run tests (Vitest) | |
| env: | |
| VITE_API_URL: ${{ secrets.VITE_API_URL }} | |
| run: yarn test:ci | |
| - name: Build project | |
| env: | |
| VITE_API_URL: ${{ secrets.VITE_API_URL }} | |
| run: yarn build | |
| - name: Comment on PR (CI Result) | |
| if: always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const status = '${{ job.status }}' | |
| const isSuccess = status === 'success' | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| const body = isSuccess | |
| ? `✅ **CI 통과했습니다!**\n\n- Lint / Type / Test / Build 모두 성공\n- dev 브랜치로 머지 가능합니다 🚀` | |
| : `❌ **CI 실패했습니다.**\n\n- 로그를 확인하고 문제를 수정해 주세요.\n- 수정 후 다시 push 하면 CI가 자동 재실행됩니다.\n- [CI 실행 로그 보기](${runUrl})` | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }) |