Dependabot은 GitHub에 내장된 의존성 자동 업데이트 서비스다. 보안 취약점이 있는 의존성을 자동 감지하여 PR을 생성하고, 정기적인 버전 업데이트를 지원한다.
주요 기능
| 기능 | 설명 |
|---|
| Security Alerts | 취약점 의존성 자동 감지 |
| Security Updates | 취약점 패치 PR 자동 생성 |
| Version Updates | 정기적 버전 업데이트 PR |
| Auto-merge | 조건 충족 시 자동 머지 |
| Grouped PRs | 의존성 그룹 PR (beta) |
.github/dependabot.yml 설정
yaml
version: 2
updates:
# npm 의존성
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Asia/Seoul"
open-pull-requests-limit: 10
reviewers:
- "my-team"
labels:
- "dependencies"
groups:
dev-dependencies:
patterns:
- "*"
dependency-type: "development"
# GitHub Actions 업데이트
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# Docker 이미지 업데이트
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
Auto-merge 설정 (GitHub Actions)
yaml
name: Dependabot Auto-merge
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
- name: Auto-merge patch updates
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
관련 문서