Skip to content
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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