-
Notifications
You must be signed in to change notification settings - Fork 0
27 lines (27 loc) · 1.09 KB
/
dependabot-auto-approve.yml
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
name: Dependabot auto-approve
on: pull_request
permissions:
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'prenagha/spring-boot-strato'
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2
- uses: actions/checkout@v4
- name: Approve a PR if not already approved
run: |
# sets the upstream metadata for `gh pr status`
gh pr checkout "$PR_URL"
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" == "APPROVED" ]; then
echo "PR already approved, skipping auto approve"
elsif [ "${{steps.dependabot-metadata.outputs.update-type}}" == "version-update:semver-major" ]; then
echo "PR contains major version upgrade, skipping auto approve"
else
gh pr review --approve "$PR_URL";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}