Skip to content

Commit 5d4567f

Browse files
chore: fix verify_library_generation.yaml for forks (#2716)
PRs opened by renovate-bot are failing `verify_library_generation` because renovate-bot opens PRs from a fork rather than main. For instance #2657 is failing: ``` env: base_ref: main head_ref: renovate/markupsafe-2.x + git checkout main Previous HEAD position was d84e607 Merge 645951c into 766646a[13](https://github.com/googleapis/sdk-platform-java/actions/runs/8914757209/job/24482995077?pr=2657#step:3:13)3d1465dca Switched to a new branch 'main' branch 'main' set up to track 'origin/main'. + git checkout renovate/markupsafe-2.x error: pathspec 'renovate/markupsafe-2.x' did not match any file(s) known to git ``` This updates the yaml file to explicitly fetch specific branches which should fix the issue. --------- Co-authored-by: Joe Wang <[email protected]>
1 parent 3ab0aa3 commit 5d4567f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/verify_library_generation.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ jobs:
2121
shell: bash
2222
run: |
2323
set -ex
24-
git checkout "${base_ref}"
25-
git checkout "${head_ref}"
24+
git checkout "${base_ref}" # Checkout a detached head, and then fetch the base ref to populate the detached head.
25+
git fetch --no-tags --prune origin +${base_ref}:refs/remotes/origin/${base_ref}
26+
git checkout "${head_ref}" # Checkout a detached head, and then fetch the head ref to populate the detached head.
27+
git fetch --no-tags --prune origin +${head_ref}:refs/remotes/origin/${head_ref}
2628
changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
2729
if [[ ${changed_directories} =~ "library_generation/" ]]; then
2830
echo "should_run=true" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)