|
21 | 21 |
|
22 | 22 | jobs: |
23 | 23 | create-pr: |
24 | | - runs-on: ubuntu-latest |
25 | | - steps: |
26 | | - - name: Checkout code |
27 | | - uses: actions/checkout@v3 |
28 | | - with: |
29 | | - token: ${{ secrets.GH_MERGE_TOKEN }} |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v3 |
| 28 | + with: |
| 29 | + token: ${{ secrets.GH_MERGE_TOKEN }} |
| 30 | + fetch-depth: 0 # Fetch all history |
30 | 31 |
|
31 | | - - name: Create Pull Request |
32 | | - uses: peter-evans/create-pull-request@v5 |
33 | | - with: |
34 | | - token: ${{ secrets.GH_MERGE_TOKEN }} |
35 | | - commit-message: 'chore: automated output update (dist)' |
36 | | - title: 'chore: automated output update (dist)' |
37 | | - body: 'This PR contains updated build output from the dist branch.' |
38 | | - branch: 'dist-to-main-pr' # PR branch |
39 | | - base: main # Target branch |
40 | | - labels: | |
41 | | - automated pr |
42 | | - dist-update |
43 | | - draft: false # Or true, if you want to review before enabling auto-merge |
| 32 | + - name: Set Git Identity |
| 33 | + run: | |
| 34 | + git config --global user.name 'googlemaps-bot' |
| 35 | + git config --global user.email '[email protected]' |
| 36 | +
|
| 37 | + - name: Create Branch for PR |
| 38 | + run: | |
| 39 | + git fetch origin main |
| 40 | + git checkout -b dist-to-main-pr origin/dist |
| 41 | +
|
| 42 | + - name: Create Pull Request |
| 43 | + run: | |
| 44 | + gh pr create \ |
| 45 | + --base main \ |
| 46 | + --head dist-to-main-pr \ |
| 47 | + --title "chore: automated output update (dist)" \ |
| 48 | + --body "This PR contains updated build output from the dist branch." \ |
| 49 | + --label "automated pr,dist-update" |
| 50 | + env: |
| 51 | + GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }} |
| 52 | + |
| 53 | + - name: Check for Existing PR and Close (Optional) |
| 54 | + run: | |
| 55 | + EXISTING_PR=$(gh pr list --base main --head dist-to-main-pr --state open --json number -q '.[].number') |
| 56 | + if [[ -n "$EXISTING_PR" ]]; then |
| 57 | + echo "Found existing open PR(s) for dist-to-main-pr: $EXISTING_PR" |
| 58 | + gh pr close "$EXISTING_PR" |
| 59 | + fi |
| 60 | + env: |
| 61 | + GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }} |
0 commit comments