Skip to content

Commit 98d34d4

Browse files
modulo11pbusko
andcommitted
Add automerge to the PRs from Dependabot
Co-authored-by: Pavel Busko <pavel.busko@sap.com> Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
1 parent 1f485f5 commit 98d34d4

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/go.yaml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
branches: ["main"]
88
workflow_dispatch: {}
99

10+
permissions:
11+
pull-requests: write
12+
1013
jobs:
1114
unit:
1215
runs-on: ubuntu-latest
@@ -16,11 +19,37 @@ jobs:
1619
with:
1720
go-version: '1.22'
1821
- run: make test
19-
# integration:
20-
# runs-on: ubuntu-latest
21-
# steps:
22-
# - uses: actions/checkout@v4
23-
# - uses: actions/setup-go@v5
24-
# with:
25-
# go-version: '1.22'
26-
# - run: make integration
22+
diego-compat:
23+
runs-on: ubuntu-latest
24+
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
repository: sap-contributions/diego-release
29+
ref: add-cnb-app-lifecycle
30+
submodules: recursive
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version: '1.22'
34+
- run: |
35+
cd src/code.cloudfoundry.org && go get -u code.cloudfoundry.org/cnbapplifecycle@${{ github.event.pull_request.head.sha }}
36+
automerge:
37+
runs-on: ubuntu-latest
38+
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'
39+
needs: [diego-compat, unit]
40+
steps:
41+
- name: Dependabot metadata
42+
id: dependabot-metadata
43+
uses: dependabot/fetch-metadata@v1
44+
- name: Approve a PR if not already approved
45+
run: |
46+
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
47+
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
48+
then gh pr review --approve "$PR_URL"
49+
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
50+
fi
51+
52+
# gh pr merge --merge --rebase "$PR_URL"
53+
env:
54+
PR_URL: ${{ github.event.pull_request.html_url }}
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)