diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 0000000000..1afdb677ec --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,25 @@ +name: Pull Request auto-merge +on: pull_request_target + +permissions: + contents: write + pull-requests: write + +jobs: + automerge: + # Only run for the microsoft-golang-bot + if: github.actor == 'microsoft-golang-bot' + runs-on: ubuntu-latest + + steps: + - name: Approve pull request + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Enable auto-merge for pull request + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}