diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..ea7d5c3 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,57 @@ +name: Auto approve and merge PRs by dependabot +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]' + steps: + + - name: wait for other checks to complete + run: | + sleep 150 + - name: Get Status of current ref + id: get-status + uses: danieldeichfuss/get-status@v0 + 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.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: "" diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml index d1b5a64..529e212 100644 --- a/.github/workflows/tflint.yml +++ b/.github/workflows/tflint.yml @@ -6,6 +6,6 @@ on: workflow_dispatch: jobs: tflint: - uses: clouddrove/test-tfsec/.github/workflows/tflint.yaml@master + uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.8 secrets: GITHUB: ${{ secrets.GITHUB }} \ No newline at end of file