Skip to content

Commit 3493f82

Browse files
authored
fix: Further workflow refinements. (#221)
1 parent a2d892b commit 3493f82

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

.github/workflows/approve-merge.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ on:
2121
- synchronize
2222
- reopened
2323
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/**'
24+
- main
2725

2826
jobs:
2927
approve-and-merge:
3028
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'
29+
if: github.event.pull_request.user.login == 'googlemaps-bot[bot]' && github.event.pull_request.head.ref == 'temp-build-branch' # change here
3230
steps:
3331
- name: Checkout code
3432
uses: actions/checkout@v3
3533
with:
36-
ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR's head commit
34+
ref: ${{ github.event.pull_request.head.ref }} # Checkout the PR's head commit
3735
token: ${{ secrets.GH_MERGE_TOKEN }}
3836

3937
- name: Approve PR

.github/workflows/dist-pr.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,23 @@ jobs:
3434
git config --global user.name 'googlemaps-bot'
3535
git config --global user.email '[email protected]'
3636
37-
- name: Create Branch for PR
38-
run: |
39-
git fetch origin main
40-
git checkout -b dist-to-main-pr origin/dist
41-
4237
- name: Create Pull Request
4338
run: |
4439
gh pr create \
4540
--base main \
46-
--head dist-to-main-pr \
41+
--head temp-build-branch \
4742
--title "chore: automated output update (dist)" \
4843
--body "This PR contains updated build output from the dist branch." \
4944
--label "automated pr,dist-update"
45+
env:
46+
GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }}
47+
48+
- name: Check for Existing PR and Close (Optional)
49+
run: |
50+
EXISTING_PR=$(gh pr list --base main --head temp-build-branch --state open --json number -q '.[].number')
51+
if [[ -n "$EXISTING_PR" ]]; then
52+
echo "Found existing open PR(s) for temp-build-branch: $EXISTING_PR"
53+
gh pr close "$EXISTING_PR"
54+
fi
5055
env:
5156
GH_TOKEN: ${{ secrets.GH_MERGE_TOKEN }}

.github/workflows/release.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Checkout main
3232
uses: actions/checkout@v3
3333
with:
34-
ref: main # Checkout *main* initially
34+
ref: main
3535
token: ${{ secrets.GH_MERGE_TOKEN }}
3636
fetch-depth: 0
3737

@@ -64,17 +64,11 @@ jobs:
6464
- name: Deploy to Firebase Hosting
6565
run: firebase deploy --only hosting
6666

67-
- name: Checkout dist branch
68-
run: git checkout -B dist origin/dist || git checkout -b dist
67+
- name: Create temporary branch
68+
run: git checkout -b temp-build-branch
6969

70-
- name: Prepare dist folder
70+
- name: Commit and Push Changes (to temp branch)
7171
run: |
72-
rm -rf samples
73-
mkdir -p dist
74-
cp -r ./dist/* ./dist/
75-
76-
- name: Commit and Push Changes (to dist)
77-
run: |
78-
git add .
72+
git add dist
7973
git commit -m "Update dist folder"
80-
git push --force origin dist
74+
git push --force origin temp-build-branch

0 commit comments

Comments
 (0)