hasura / smooth-checkout-buildkite-plugin

All the things you need during a Buildkite checkout :butter: :kite:
Apache License 2.0
14 stars 12 forks source link

checkout out to CHECKOUT_REF instead of FETCH_HEAD #30

Closed scriptnull closed 1 year ago

scriptnull commented 1 year ago

Our documentation states that three kinds of values are possible for ref option.

image

From v4.0.0, we started checking out to FETCH_HEAD instead of CHECKOUT_REF (reference)

This is okay when ref is a commit or tag. Because both are readonly and a user using them in their builds don't intend to do a git push in those cases. But when a ref is pointing to a branch name, then the user might be intending to do a git push to that branch at some point in their build. Using the FETCH_HEAD instead of CHECKOUT_REF causes the repo to be in detached HEAD state which will not allow a git push. This PR addresses this particular regression when ref is pointing to a branch name.

scriptnull commented 1 year ago

Tested via https://buildkite.com/hasura/smooth-checkout-buildkite-plugin-integration-tests/builds/27