Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit c154d83

Browse files
authored
ci: replace auto-merge with github script
ref https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request Signed-off-by: Marvin <7430964+marpme@users.noreply.github.com>
1 parent ecf23bb commit c154d83

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

.github/workflows/depsmerge.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
name: auto-merge
1+
name: Dependabot Auto-Merge
2+
on: pull_request
23

3-
on:
4-
pull_request:
5-
branches:
6-
- main
4+
permissions:
5+
pull-requests: write
76

87
jobs:
9-
auto-merge:
8+
dependabot-merge:
109
runs-on: ubuntu-latest
10+
if: ${{ github.actor == 'dependabot[bot]' }}
1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: ahmadnassri/action-dependabot-auto-merge@v2
12+
- name: Dependabot metadata
13+
id: metadata
14+
uses: dependabot/fetch-metadata@v1
1415
with:
15-
target: minor
16-
github-token: ${{ secrets.AUTO_MERGE_TOKEN }}
16+
github-token: "${{ secrets.GITHUB_TOKEN }}"
17+
- name: Approve a PR
18+
run: gh pr review --approve "$PR_URL"
19+
env:
20+
PR_URL: ${{github.event.pull_request.html_url}}
21+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
22+
- name: Enable auto-merge for Dependabot PRs
23+
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
24+
run: gh pr merge --auto --merge "$PR_URL"
25+
env:
26+
PR_URL: ${{github.event.pull_request.html_url}}
27+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)