|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Approve and Merge Release Pull Request |
| 16 | + |
| 17 | +on: |
| 18 | + pull_request_target: |
| 19 | + types: |
| 20 | + - opened |
| 21 | + - synchronize |
| 22 | + - reopened |
| 23 | + branches: |
| 24 | + - main # Only trigger for PRs targeting main |
| 25 | + paths: # Optional but recommended: only trigger for changes in specific parts of the repo |
| 26 | + - 'dist/**' |
| 27 | + |
| 28 | +jobs: |
| 29 | + approve-and-merge: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + if: github.event.pull_request.user.login == 'googlemaps-bot[bot]' && github.event.pull_request.head.ref == 'dist-to-main-pr' |
| 32 | + steps: |
| 33 | + - name: Checkout code |
| 34 | + uses: actions/checkout@v3 |
| 35 | + with: |
| 36 | + ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR's head commit |
| 37 | + token: ${{ secrets.GH_MERGE_TOKEN }} |
| 38 | + |
| 39 | + - name: Approve PR |
| 40 | + run: gh pr review --approve "$PR_URL" |
| 41 | + env: |
| 42 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 43 | + GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }} |
| 44 | + |
| 45 | + - name: Merge PR |
| 46 | + run: gh pr merge --auto --squash --delete-branch "$PR_URL" |
| 47 | + env: |
| 48 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 49 | + GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }} |
0 commit comments