Skip to content

Merge pull request #158 from team-nabi/develop #496

Merge pull request #158 from team-nabi/develop

Merge pull request #158 from team-nabi/develop #496

Workflow file for this run

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: '20'
cache: 'npm'
cache-dependency-path: ./pnpm-lock.yaml
- uses: pnpm/action-setup@v2
with:
version: 8
# package.json에 명시된 의존성을 설치합니다.
- name: Install Dependencies
run: pnpm install
# 아래 단계에서 .env 파일을 생성하고 시크릿 값을 설정합니다.
- name: Set Environment Variables
env:
NEXT_PUBLIC_API_ADDRESS: ${{ secrets.NEXT_PUBLIC_API_ADDRESS }}
NEXT_PUBLIC_API_MOCKING: ${{ secrets.NEXT_PUBLIC_API_MOCKING }}
NEXT_PUBLIC_API_MOCKING_ADDRESS: ${{ secrets.NEXT_PUBLIC_API_MOCKING_ADDRESS }}
NEXT_PUBLIC_CURRENT_ADDRESS: ${{ secrets.NEXT_PUBLIC_CURRENT_ADDRESS }}
CHROMATIC_TOKEN: ${{ secrets.CHROMATIC_TOKEN }}
run: |
echo "NEXT_PUBLIC_API_ADDRESS=$NEXT_PUBLIC_API_ADDRESS" >> .env
echo "NEXT_PUBLIC_API_MOCKING=$NEXT_PUBLIC_API_MOCKING" >> .env
echo "NEXT_PUBLIC_API_MOCKING_ADDRESS=$NEXT_PUBLIC_API_MOCKING_ADDRESS" >> .env
echo "NEXT_PUBLIC_CURRENT_ADDRESS=$NEXT_PUBLIC_CURRENT_ADDRESS" >> .env
echo "CHROMATIC_TOKEN=$CHROMATIC_TOKEN" >> .env
# 빌드를 수행합니다.
- name: Build
run: pnpm build
# 테스트를 수행합니다.
- name: Run tests
run: pnpm 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 : "actions 결과를 다시 확인해주세요. -자동으로 작성됨-",
event : "REQUEST_CHANGES"
})
if: failure()