generated from sang-w0o/spring-boot-mvc-kotlin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (55 loc) · 1.61 KB
/
pr-test-bot.yml
File metadata and controls
61 lines (55 loc) · 1.61 KB
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
name: PullRequestGradleTest
on:
pull_request_target:
branches:
- dev
jobs:
test:
name: GradleTest
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name }}
- name: Setup JDK 1.8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Grant Permissions to gradlew
run: chmod +x gradlew
- name: Test
run: ./gradlew test
- name: Test Success
if: success()
uses: actions/github-script@0.2.0
with:
github-token: ${{ github.token }}
script: |
const pull_number = "${{github.event.number}}"
await github.pulls.createReview({
...context.repo,
pull_number,
body: "테스트 모두 통과!",
event: "APPROVE"
})
- name: Test Fail
if: failure()
uses: actions/github-script@0.2.0
with:
github-token: ${{ github.token }}
script: |
const pull_number = "${{github.event.number}}"
await github.pulls.createReview({
...context.repo,
pull_number,
body: "테스트 코드 실패.. 다시 작성해 주세요.",
event: "REQUEST_CHANGES"
})
await github.pulls.update({
...context.repo,
pull_number,
state: "closed"
})