Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix verify_library_generation.yaml for forks #2716

Merged
merged 9 commits into from
May 2, 2024
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}
Copy link
Collaborator

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
Collaborator

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 "${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}
Copy link
Collaborator

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

changed_directories="$(git diff --name-only ${base_ref} ${head_ref})"
if [[ ${changed_directories} =~ "library_generation/" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
Expand Down
Loading