Skip to content

Commit

Permalink
chore: follow up fix to verify_library_generation (#2721)
Browse files Browse the repository at this point in the history
#2716 didn't quite
fix what it should have. Follow up to fix the error:

```
Previous HEAD position was e54601f Merge 30c7c5b into 5d4567f
Switched to a new branch 'main'
branch 'main' set up to track 'origin/main'.
+ git fetch --no-tags --prune origin +main:refs/remotes/origin/main
From https://github.com/googleapis/sdk-platform-java
 - [deleted]             (none)     -> origin/main
+ git checkout renovate/markupsafe-2.x
error: pathspec 'renovate/markupsafe-2.x' did not match any file(s) known to git
```

---------

Co-authored-by: Joe Wang <[email protected]>
  • Loading branch information
alicejli and JoeWang1127 authored May 3, 2024
1 parent acfddd7 commit 2e360ef
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ jobs:
shell: bash
run: |
set -ex
# Checkout a detached head, and then fetch the base ref to populate the detached head.
git checkout "${base_ref}"
git fetch --no-tags --prune origin +${base_ref}:refs/remotes/origin/${base_ref}
# Checkout a detached head, and then fetch the head ref to populate the detached head.
git checkout "${head_ref}"
git fetch --no-tags --prune origin +${head_ref}:refs/remotes/origin/${head_ref}
changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
# PRs that come from a fork need to be handled differently
if [[ ${head_repo_name} == ${base_repo} ]]; then
git checkout ${base_ref}
git checkout ${head_ref}
changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
else
git remote add fork ${head_repo_url}
git fetch fork # create a mapping of the fork
git checkout -b "${head_ref}" fork/${head_ref}
changed_directories="$(git diff --name-only "fork/${head_ref}" "origin/${base_ref}")"
fi
if [[ ${changed_directories} =~ "library_generation/" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
Expand All @@ -31,6 +35,9 @@ jobs:
env:
base_ref: ${{ github.event.pull_request.base.ref }}
head_ref: ${{ github.event.pull_request.head.ref }}
head_repo_url: ${{ github.event.pull_request.head.repo.html_url }}
head_repo_name: ${{ github.event.pull_request.head.repo.full_name }}
base_repo: ${{ github.repository }}
library-generation-integration-tests:
runs-on: ubuntu-22.04
needs: should-run-library-generation-tests
Expand Down

0 comments on commit 2e360ef

Please sign in to comment.