[Feat] 어드민 API 연동 #37
This file contains 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: Build and Comment | |
on: | |
pull_request: | |
branches: | |
- main | |
- dev | |
paths: | |
- "admin/**" | |
jobs: | |
build-admin: | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./admin | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
- name: Install dependencies | |
run: yarn | |
working-directory: ${{ env.working-directory }} | |
- name: Build project | |
run: yarn build | |
working-directory: ${{ env.working-directory }} | |
comment-admin: | |
needs: build-admin | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
# 성공 시 코멘트 | |
- name: Add a comment on success | |
if: ${{ needs.build-admin.result == 'success' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '빌드를 성공했습니다! :tada:' | |
}) | |
# 실패 시 코멘트 | |
- name: Add a comment on failure | |
if: ${{ needs.build-admin.result == 'failure' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '빌드를 실패했습니다. :x: 자세한 내용은 로그를 참고해주세요.' | |
}) |