Move auto-merge to separate workflow

This commit is contained in:
Jan Raasch 2024-01-23 11:46:13 +01:00
parent 993dcdbc45
commit d255667dfb
2 changed files with 29 additions and 23 deletions

29
.github/workflows/auto-merge.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Dependabot auto-merge
on:
pull_request:
branches:
- master
permissions:
issues: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
if: contains(fromJSON('["version-update:semver-patch", "version-update:semver-minor"]'), steps.dependabot-metadata.outputs.update-type)
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@ -31,29 +31,6 @@ jobs:
name: build name: build
path: ./public path: ./public
dependabot:
name: Dependabot Auto-Merge
needs: build
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
if: contains(fromJSON('["version-update:semver-patch", "version-update:semver-minor"]'), steps.dependabot-metadata.outputs.update-type)
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
deploy: deploy:
needs: build needs: build
name: Deploy to GitHub Pages name: Deploy to GitHub Pages