Skip to content

test123

test123 #2

name: Auto-Merge Dependabot PRs
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Check for merge conflicts
id: merge_conflict_check
run: |
git fetch origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
if ! git merge --no-commit --no-ff ${{ github.head_ref }}; then
echo "::set-output name=has_conflicts::true"
else
echo "::set-output name=has_conflicts::false"
git merge --abort
fi
- name: Auto-Merge if No Conflicts
if: steps.merge_conflict_check.outputs.has_conflicts == 'false'
run: |
gh pr merge ${{ github.event.pull_request.number }} --auto --squash --delete-branch --repo ${{ github.repository }}
- name: Fail Job if Merge Conflicts
if: steps.merge_conflict_check.outputs.has_conflicts == 'true'
run: |
echo "Merge conflicts found. Skipping auto-merge."
exit 1