Skip to content

Commit c03ad07

Browse files
authored
fix: Update dist-pr.yml (#198)
Switched to the gh actions instead of peter-evans, since I suspect there could be an edge case we're missing, or some other undocumented thing. Literally nothing worked with that action.
1 parent f975978 commit c03ad07

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

.github/workflows/dist-pr.yml

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,41 @@ on:
2121

2222
jobs:
2323
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
3031

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

Comments
 (0)