-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (63 loc) · 2.14 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Pull request
on:
push:
branches:
- master
- develop
pull_request:
branches:
- '**'
jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
# 해당 저장소의 코드를 가져옵니다.
- name: Checkout
uses: actions/checkout@v4
# Node 16 버전을 사용합니다.
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: ./pnpm-lock.yaml
# package.json에 명시된 의존성을 설치합니다.
- name: Install Dependencies
run: npm install
# 아래 단계에서 .env 파일을 생성하고 시크릿 값을 설정합니다.
# - name: Set Environment Variables
# env:
# NEXT_PUBLIC_API_ADDRESS: ${{ secrets.NEXT_PUBLIC_API_ADDRESS }}
# NEXT_PUBLIC_CHANNEL_ID: ${{ secrets.NEXT_PUBLIC_CHANNEL_ID }}
# NEXT_PUBLIC_DISLIKE_CHANNEL_ID: ${{ secrets.NEXT_PUBLIC_DISLIKE_CHANNEL_ID }}
# run: |
# echo "NEXT_PUBLIC_API_ADDRESS=$NEXT_PUBLIC_API_ADDRESS" >> .env
# echo "NEXT_PUBLIC_CHANNEL_ID=$NEXT_PUBLIC_CHANNEL_ID" >> .env
# echo "NEXT_PUBLIC_DISLIKE_CHANNEL_ID=$NEXT_PUBLIC_DISLIKE_CHANNEL_ID" >> .env
# 빌드를 수행합니다.
- name: Build
run: npm run build
# 테스트를 수행합니다.
- name: Run tests
run: npm run test
- name: if_fail
uses: actions/github-script@v4
with:
github-token: ${{ secrets.TOKEN_ACTIONS_CLIENT }}
script: |
const ref = "${{github.ref}}"
const pull_number = Number(ref.split("/")[2])
console.log(pull_number, ref.split("/"), github.ref)
await github.pulls.createReview({
...context.repo,
pull_number,
body : "테스트코드를 다시 확인해주세요. ",
event : "REQUEST_CHANGES"
})
await github.pulls.update({
...context.repo,
pull_number,
state: "closed"
})
if: failure()