-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.62 KB
/
pr-dependabot.yaml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: PR Dependabot Check
on:
pull_request:
paths-ignore:
- '*.md'
- 'LICENSE.md'
permissions:
contents: write
pull-requests: write
jobs:
go_version:
outputs:
go_version: ${{ steps.go_version.outputs.GO_VERSION }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Find Go version
id: go_version
run: |
echo "GO_VERSION=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
test-dp-pr:
needs:
- go_version
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ needs.go_version.outputs.go_version }}
cache-dependency-path: ./go.sum
- run: make test
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
needs: test-dp-pr
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}