Skip to content

Commit

Permalink
Merge pull request #118 from Somnath-Chattaraj/merge
Browse files Browse the repository at this point in the history
update auto merge
  • Loading branch information
Somnath-Chattaraj authored Oct 15, 2024
2 parents 4ab3303 + 635b9a0 commit a1026dc
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
name: Auto-Merge Dependabot PRs
name: auto-merge

on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
pull_request_target:
branches:
- master

permissions:
contents: read

jobs:
automerge:
auto-merge:
permissions:
contents: none
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
if: github.actor == 'dependabot[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
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
command: 'squash and merge'
target: minor

0 comments on commit a1026dc

Please sign in to comment.