-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: update the automerge workflow for static checks (#42)
Co-authored-by: Anmol Nagpal <[email protected]>
- Loading branch information
1 parent
64ccecd
commit 2179eb0
Showing
1 changed file
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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}} | ||
|