Skip to content

Commit

Permalink
Feat: update the automerge workflow (#38)
Browse files Browse the repository at this point in the history
Co-authored-by: Anmol Nagpal <anmol@clouddrove.com>
  • Loading branch information
vaibhav7797 and anmolnagpal committed Dec 5, 2023
1 parent 12f0fce commit ba2a8fd
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Auto approve and merge PRs by dependabot
on:
pull_request:

permissions:
contents: write
pull-requests: write

jobs:
autoapprove:
name: Auto Approve a PR by dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: wait for other checks to complete
run: |
sleep 150
- name: Get Status of current PR
id: get-status
uses: danieldeichfuss/get-status@v0.0.10
with:
ref: ${{ github.sha }}

- name: Approve a PR for Github Bot
if: ${{steps.get-status.outputs.all-checks-completed == 'true' && steps.get-status.outputs.all-checks-passed == 'true'}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Approve a PR for Anmol nagpal
if: ${{steps.get-status.outputs.all-checks-completed == 'true' && steps.get-status.outputs.all-checks-passed == 'true'}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB}}

automerge:
runs-on: ubuntu-latest
needs: autoapprove
steps:
- id: automerge
name: automerge
uses: pascalgn/automerge-action@v0.15.6
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
MERGE_FILTER_AUTHOR: 'dependabot[bot]'
MERGE_METHOD: "merge"
MERGE_DELETE_BRANCH: "true"
MERGE_LABELS: "dependencies"
MERGE_REQUIRED_APPROVALS: ""

0 comments on commit ba2a8fd

Please sign in to comment.