Skip to content

chore: fix verify_library_generation.yaml for forks#2716

Merged
alicejli merged 9 commits intomainfrom
fixVerify_library_generation
May 2, 2024
Merged

chore: fix verify_library_generation.yaml for forks#2716
alicejli merged 9 commits intomainfrom
fixVerify_library_generation

Conversation

@alicejli
Copy link
Contributor

@alicejli alicejli commented May 2, 2024

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 d84e6072d Merge 645951c0497bf9cdb42e6323cd90a08d77a1926a into 766646a9e0bed6c8e804eb1e6ab4d[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.

@alicejli alicejli requested a review from a team May 2, 2024 15:08
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label May 2, 2024
run: |
set -ex
git checkout "${base_ref}"
git fetch --no-tags --prune origin +${base_ref}:refs/remotes/origin/${base_ref}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why git fetch after git checkout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't actually matter too much for L23-L24, but it's needed for L25/26 so that it can find the forked branches. I can revert this line if preferred.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not actually useful, I think we should revert it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we do need it. Added some comments to explain.

git checkout "${base_ref}"
git fetch --no-tags --prune origin +${base_ref}:refs/remotes/origin/${base_ref}
git checkout "${head_ref}"
git fetch --no-tags --prune origin +${head_ref}:refs/remotes/origin/${head_ref}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this line before git checkout "${head_ref}"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments to explain

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xs Pull request size is extra small. labels May 2, 2024
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. and removed size: l Pull request size is large. labels May 2, 2024
Co-authored-by: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 2024

Quality Gate Passed Quality Gate passed for 'gapic-generator-java-root'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 2024

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@alicejli alicejli merged commit 5d4567f into main May 2, 2024
@alicejli alicejli deleted the fixVerify_library_generation branch May 2, 2024 17:14
alicejli added a commit that referenced this pull request May 3, 2024
#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 <106995533+JoeWang1127@users.noreply.github.com>
lqiu96 pushed a commit that referenced this pull request May 22, 2024
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>
lqiu96 pushed a commit that referenced this pull request May 22, 2024
#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 <106995533+JoeWang1127@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants