From 949a8cec8bf7c8eb931f054bca22addfc1d36583 Mon Sep 17 00:00:00 2001 From: Jungu Lee <100949102+jobkaeHenry@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:38:19 +0900 Subject: [PATCH] =?UTF-8?q?Client-CI=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main branch 에 Push | PR시 Client 디렉토리에 있는 파일에 한해 Unit 테스트 (Jest)를 실행, 테스트 실패시 Change request를 알림 --- .github/workflows/Client-CI.yml | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/Client-CI.yml diff --git a/.github/workflows/Client-CI.yml b/.github/workflows/Client-CI.yml new file mode 100644 index 0000000..3183a84 --- /dev/null +++ b/.github/workflows/Client-CI.yml @@ -0,0 +1,43 @@ +name: Client Unit test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + run_test: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: install deps + run: npm install + working-directory: client + + - name: run test + run: npm run test:ci + working-directory: client + + - name: Request change + uses: actions/github-script@0.2.0 + with: + github-token: ${{github.token}} + script: | + const ref = "${{github.ref}}" + const pull_number = Number(ref.split("/")[2]) + await github.pulls.createReview({ + ...context.repo, + pull_number, + body:"[Unit test] 유닛테스트를 통과하지 못했습니다.", + event: "REQUEST_CHANGES" + }) + if: failure()