Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#085 Github Actions workflow 추가 #90

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/auto_merge_approved_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Auto Merge Approved PRs"

on:
pull_request_review:
types: [submitted]

jobs:
auto_merge:
runs-on: ubuntu-latest
steps:
- name: "Get Pull Request"
id: pr
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
return JSON.stringify(pr);
- name: "Check Approvals"
id: check
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = JSON.parse(steps.pr.outputs.result);
const reviews = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
});
const approvals = reviews.data.filter(review => review.state === 'APPROVED');
core.setOutput('result', approvals.length >= 2);
- name: "Merge PR"
if: steps.check.outputs.result
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
# 1. 레포지토리 클론
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# 2. Docker Compose로 서비스 빌드 및 재시작
- name: Set up Docker
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build and Deploy Docker Images
run: |
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint and Test

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
lint_and_test:
name: Lint and Test
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Install pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: true

# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"

# Run lint
- name: Run lint
run: pnpm eslint .

# Run tests
- name: Run tests
run: pnpm test
Loading