Improve Cloud Build module for parallel builds and multi-stage Docker caching #61
This file contains hidden or 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
| name: review-bot-prs | |
| # This Action only has the purpose that those Pull requests which are generated by Bots | |
| # Such as DependaBot and Renovate will also be approved | |
| # This prevents these from accidentally triggering anomolies in our reports | |
| # Since the engineer who merges is usually not the one who approves | |
| # See Jeff Yates article: | |
| # https://blog.somewhatabstract.com/2021/10/11/setting-up-dependabot-with-github-actions-to-approve-and-merge/ | |
| on: pull_request_target | |
| permissions: | |
| pull-requests: 'write' | |
| contents: 'write' | |
| id-token: 'write' | |
| # When a new revision is pushed to a PR, cancel all in-progress CI runs for that | |
| # PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| review-bot-prs: | |
| # Checking the actor will prevent your Action run failing on non-bot PRs | |
| # but also ensures that it only does work for bots PRs | |
| if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'app[renovate]' || github.actor == 'khan-districts-bot' || github.actor == 'khan-actions-bot' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Here the PR gets approved, with the approver listed as `github-actions` | |
| - name: 'approve-the-PR' | |
| env: | |
| PR_NUMBER: "${{ github.event.pull_request.number }}" | |
| # We need the token for the "gh" command, see: | |
| # https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows | |
| PULL_REQUEST_NUMBER: "${{ github.event.pull_request.number }}" | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: 'echo "PR_NUMBER is $PR_NUMBER"; gh pr review --repo Khan/terraform-modules --approve "$PR_NUMBER"' |