feat: SSE 알림 구현 #15
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: PR Check | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Leave CI pending comment | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| await github.rest.issues.createComment({ | |
| ...context.repo, | |
| issue_number: context.issue.number, | |
| body: "🛠 PR 검사를 시작합니다. 잠시만 기다려 주세요!" | |
| }); | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| id: install | |
| run: npm ci | |
| - name: Lint check | |
| id: lint | |
| continue-on-error: true | |
| run: npm run lint | |
| - name: Format check | |
| id: format | |
| continue-on-error: true | |
| run: npm run format | |
| - name: Build check | |
| id: build | |
| continue-on-error: true | |
| run: npm run build | |
| - name: Report Status | |
| if: always() | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const steps = { | |
| lint: '${{ steps.lint.outcome }}', | |
| format: '${{ steps.format.outcome }}', | |
| build: '${{ steps.build.outcome }}' | |
| }; | |
| const emoji = (status) => status === 'success' ? '✅' : '❌'; | |
| const body = `## CI Status Report\n\n` + | |
| `### 검사 결과\n` + | |
| `- Lint: ${emoji(steps.lint)} ${steps.lint}\n` + | |
| `- Format: ${emoji(steps.format)} ${steps.format}\n` + | |
| `- Build: ${emoji(steps.build)} ${steps.build}\n\n` + | |
| `${Object.values(steps).every(s => s === 'success') ? '✅ 모든 검사가 통과되었습니다.' : '❌ 일부 검사가 실패했습니다.'}`; | |
| await github.rest.issues.createComment({ | |
| ...context.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| if (Object.values(steps).some(s => s === 'failure')) { | |
| core.setFailed('Some checks failed'); | |
| } |