Skip to content

Commit 03fbf73

Browse files
committed
optimize auto merge for github actions
1 parent 60350fe commit 03fbf73

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Dependabot GitHub Actions Auto Merge
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/**'
7+
branches: [ main ]
8+
9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
13+
jobs:
14+
dependabot:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.actor == 'dependabot[bot]' }}
17+
steps:
18+
- name: Dependabot metadata
19+
id: dependabot-metadata
20+
uses: dependabot/fetch-metadata@v2
21+
- name: Enable auto-merge for Dependabot PRs
22+
if: ${{steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions'}}
23+
run: gh pr merge --auto --merge "$PR_URL"
24+
env:
25+
PR_URL: ${{github.event.pull_request.html_url}}
26+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/dotnet.yml

-16
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,3 @@ jobs:
3333
working-directory: ./src
3434
run: |
3535
dotnet test --configuration Release --no-restore --no-build --verbosity normal
36-
37-
dependabot:
38-
name: Dependabot Auto Merge
39-
runs-on: ubuntu-latest
40-
needs:
41-
- build
42-
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}
43-
44-
steps:
45-
- name: Dependabot Auto Merge
46-
uses: dailydevops/dependamerge-action@v1.2.19
47-
with:
48-
token: ${{ secrets.GITHUB_TOKEN }}
49-
command: squash
50-
handle-submodule: true
51-
target: minor

0 commit comments

Comments
 (0)