From 6739275b7ba6cf3943660546ba71e2f341e1bab4 Mon Sep 17 00:00:00 2001 From: HYUN MIN KO Date: Fri, 7 Jan 2022 16:43:38 +0900 Subject: [PATCH 1/6] Create node.js.yml --- .github/workflows/node.js.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..96e2552 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm test + From 351bd9b5dc2bc667b81787462927dec9b001b4e8 Mon Sep 17 00:00:00 2001 From: yalco Date: Fri, 7 Jan 2022 16:47:34 +0900 Subject: [PATCH 2/6] test --- .github/workflows/{node.js.yml => test.yml} | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) rename .github/workflows/{node.js.yml => test.yml} (53%) diff --git a/.github/workflows/node.js.yml b/.github/workflows/test.yml similarity index 53% rename from .github/workflows/node.js.yml rename to .github/workflows/test.yml index 96e2552..f90241e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/test.yml @@ -26,5 +26,27 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm test + + - name: Execute text + run: npm test + + - name: if fail + uses: actions/github-script@0.2.0 // github-script 액션을 사용한다. + 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:"테스트가 실패했습니다.", + event: "REQUEST_CHANGES" + }) + await github.pulls.update({ + ...context.repo, + pull_number, + state: "closed" + }) + if: failure() From b62abb725d96e279bb0a9b2bd245e64b6b2ed274 Mon Sep 17 00:00:00 2001 From: yalco Date: Fri, 7 Jan 2022 16:50:05 +0900 Subject: [PATCH 3/6] edit --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f90241e..150ce98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,9 +31,8 @@ jobs: run: npm test - name: if fail - uses: actions/github-script@0.2.0 // github-script 액션을 사용한다. + uses: actions/github-script@v5.0.0 with: - github-token: ${{github.token}} script: | const ref = "${{github.ref}}" const pull_number = Number(ref.split("/")[2]) From 5e1438da9af36e4e45bf288cf1c47699d4f0c976 Mon Sep 17 00:00:00 2001 From: yalco Date: Fri, 7 Jan 2022 16:53:03 +0900 Subject: [PATCH 4/6] . --- .github/workflows/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 150ce98..179e5bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,11 +21,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - name: Execute text run: npm test From edd01b53fe445be15a5a170d61e441464d6c823f Mon Sep 17 00:00:00 2001 From: yalco Date: Fri, 7 Jan 2022 16:54:49 +0900 Subject: [PATCH 5/6] . --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 179e5bd..a6cafc7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,8 +4,6 @@ name: Node.js CI on: - push: - branches: [ main ] pull_request: branches: [ main ] From 8d853957b62251ed1f1de24a35e0f2347a65fbed Mon Sep 17 00:00:00 2001 From: yalco Date: Fri, 7 Jan 2022 16:55:26 +0900 Subject: [PATCH 6/6] . --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index c0a56df..fe02a56 100644 --- a/test.js +++ b/test.js @@ -1,4 +1,4 @@ -const evenNumber = 10 +const evenNumber = 11 if (evenNumber % 2 !== 0) { throw '짝수가 아닙니다!'