Skip to content

Commit 18473a7

Browse files
authored
chore: push current branch to remote (#3455)
Fix error when updating googleapis commit in a new branch. ``` fatal: unknown commit origin/generate-libraries-main ``` Example run: https://github.com/googleapis/sdk-platform-java/actions/runs/12286920597/job/34287983045
1 parent d7579ba commit 18473a7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/scripts/update_googleapis_commit.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[]
6161
# branch; otherwise checkout the pull request.
6262
if [ -z "${pr_num}" ]; then
6363
git checkout -b "${current_branch}"
64+
# Push the current branch to remote so that we can
65+
# compare the commits later.
66+
git push -u origin "${current_branch}"
6467
else
6568
gh pr checkout "${pr_num}"
6669
fi
@@ -102,7 +105,7 @@ fi
102105

103106
if [ -z "${pr_num}" ]; then
104107
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
105-
git fetch -q --unshallow remote_repo
108+
git fetch -q remote_repo
106109
git push -f remote_repo "${current_branch}"
107110
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
108111
else

hermetic_build/library_generation/owlbot/templates/java_library/.github/scripts/update_generation_config.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[]
102102
# branch; otherwise checkout the pull request.
103103
if [ -z "${pr_num}" ]; then
104104
git checkout -b "${current_branch}"
105+
# Push the current branch to remote so that we can
106+
# compare the commits later.
107+
git push -u origin "${current_branch}"
105108
else
106109
gh pr checkout "${pr_num}"
107110
fi
@@ -156,7 +159,7 @@ fi
156159

157160
if [ -z "${pr_num}" ]; then
158161
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
159-
git fetch -q --unshallow remote_repo
162+
git fetch -q remote_repo
160163
git push -f remote_repo "${current_branch}"
161164
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
162165
else

0 commit comments

Comments
 (0)