Skip to content

Commit

Permalink
Feat: update the automerge workflow for static checks (#42)
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 5, 2023
1 parent 64ccecd commit 2179eb0
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,35 @@ permissions:
pull-requests: write

jobs:
static-checks:
name: Auto Approve a PR by dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'dependencies'
strategy:
matrix:
tf-checks: ["tf-lint", "tfsec", "tf-checks"]
steps:
- name: Wait for "${{ matrix.tf-checks }}" to succeed
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: ${{ matrix.tf-checks }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

autoapprove:
name: Auto Approve a PR by dependabot
needs: static-checks
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/[email protected]
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'}}
- 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
if: ${{steps.get-status.outputs.all-checks-completed == 'true' && steps.get-status.outputs.all-checks-passed == 'true'}}
- name: Approve a PR for Anmol nagpal
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
Expand Down

0 comments on commit 2179eb0

Please sign in to comment.