Skip to content

Commit

Permalink
Feat: Add automerge github shared workflow (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Anmol Nagpal <[email protected]>
  • Loading branch information
vaibhav7797 and anmolnagpal authored Dec 27, 2023
1 parent 848c57c commit dfc0e8d
Showing 1 changed file with 9 additions and 42 deletions.
51 changes: 9 additions & 42 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,12 @@
name: Auto approve and merge PRs by dependabot
---
name: Auto merge
on:
pull_request:
types:
- synchronize
- opened
- reopened

permissions:
contents: write
pull-requests: write

jobs:
autoapprove:
name: Auto Approve a PR by dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && success() && github.event_name == 'pull_request'
steps:
- name: Approve a PR for Github Bot
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
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/[email protected]
if: github.event_name == 'pull_request' && github.event.action == 'synchronize' && github.event.pull_request.draft == false && success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
MERGE_FILTER_AUTHOR: 'dependabot[bot]'
MERGE_METHOD: "merge"
MERGE_DELETE_BRANCH: "true"
MERGE_LABELS: "dependencies"
MERGE_REQUIRED_APPROVALS: ""
auto-merge:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'tf-checks-single_node_vpc-example / Evaluate Terraform versions (1.6.1, ./_example/single_node_vpc/)'
...

0 comments on commit dfc0e8d

Please sign in to comment.