-
Notifications
You must be signed in to change notification settings - Fork 42
37 lines (37 loc) · 1.12 KB
/
dependabot-automations.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
28
29
30
31
32
33
34
35
36
37
name: Dependabot Automation
on:
pull_request_target:
types:
- opened
- synchronize
permissions:
pull-requests: write
contents: write
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
auto-approve-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install GH CLI
uses: dev-hanz-ops/install-gh-cli-action@v0.2.0
- name: Approve a PR if not already approved
id: auto_approve
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL"
else echo "PR already approved.";
fi
auto-merge:
needs: auto-approve-merge
runs-on: ubuntu-latest
steps:
- name: Install GH CLI
uses: dev-hanz-ops/install-gh-cli-action@v0.2.0
- name: Auto-merge PR
run: gh pr merge --auto --squash "$PR_URL"