Skip to content

Commit

Permalink
chore: fix verify_library_generation.yaml for forks (#2716)
Browse files Browse the repository at this point in the history
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 <106995533+JoeWang1127@users.noreply.github.com>
  • Loading branch information
2 people authored and lqiu96 committed May 22, 2024
1 parent f67fd69 commit c3c4782
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ jobs:
shell: bash
run: |
set -ex
git checkout "${base_ref}"
git checkout "${head_ref}"
git checkout "${base_ref}" # Checkout a detached head, and then fetch the base ref to populate the detached head.
git fetch --no-tags --prune origin +${base_ref}:refs/remotes/origin/${base_ref}
git checkout "${head_ref}" # Checkout a detached head, and then fetch the head ref to populate the detached head.
git fetch --no-tags --prune origin +${head_ref}:refs/remotes/origin/${head_ref}
changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
if [[ ${changed_directories} =~ "library_generation/" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit c3c4782

Please sign in to comment.