docs: #46 Init README.md #40
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: | |
CI | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 브랜치로 이동 | |
uses: actions/checkout@v3 | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
- name: application.yml 생성 | |
run: | | |
mkdir src/main/resources | |
touch src/main/resources/application.properties | |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.properties | |
- name: Cache Gradle | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-m2 | |
- name: 프로젝트 build | |
run : mvn -B package -DskipTests=true --file pom.xml | |
- name: build 실패 PR 닫기 | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.TOKEN }} | |
script: | | |
const pull_number = ${{ github.event.pull_request.number }} | |
const updated_title = `[BUILD FAIL] ${{ github.event.pull_request.title }}` | |
await github.rest.pulls.createReview({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
body: '드에 실패했습니다.', | |
event: 'REQUEST_CHANGES' | |
}) | |
await github.rest.pulls.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
title: updated_title, | |
state: 'closed' | |
}) | |
- name: build 통과 PR merge | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.TOKEN }} | |
script: | | |
const pull_number = ${{ github.event.pull_request.number }} | |
await github.rest.pulls.createReview({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
body: '빌드 통과해 main 브랜치로 자동 머지합니다.', | |
event: 'REQUEST_CHANGES' | |
}) | |
await github.rest.pulls.merge({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
}) |