Skip to content

Commit

Permalink
optimize auto merge for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Dec 13, 2024
1 parent 60350fe commit 03fbf73
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/dependabot-github-actions-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dependabot GitHub Actions Auto Merge

on:
pull_request:
paths:
- '.github/workflows/**'
branches: [ main ]

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
16 changes: 0 additions & 16 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,3 @@ jobs:
working-directory: ./src
run: |
dotnet test --configuration Release --no-restore --no-build --verbosity normal
dependabot:
name: Dependabot Auto Merge
runs-on: ubuntu-latest
needs:
- build
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

steps:
- name: Dependabot Auto Merge
uses: dailydevops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: squash
handle-submodule: true
target: minor

0 comments on commit 03fbf73

Please sign in to comment.