diff --git a/README.md b/README.md index 1908dea..3837e47 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ steps: - label: ":pipeline:" command: "buildkite-agent pipeline upload" plugins: - - git-ssh-checkout#v0.4.0: + - git-ssh-checkout#v0.4.1: ssh-secret-key-name: 'SUPER_SECRET_SSH_KEY' ``` @@ -49,7 +49,7 @@ steps: - label: ":hammer_and_pick: Run linter" command: "make lint" plugins: &base-plugins - - git-ssh-checkout#v0.4.0: &checkout-plugin + - git-ssh-checkout#v0.4.1: &checkout-plugin ssh-secret-key-name: 'SUPER_SECRET_SSH_KEY' - label: ":hammer_and_pick: Run tests" @@ -59,7 +59,7 @@ steps: - label: ":docker: Build image" command: "make build-image" plugins: - - git-ssh-checkout#v0.4.0: *checkout-plugin + - git-ssh-checkout#v0.4.1: *checkout-plugin - ecr#v2.9.0: login: true ``` diff --git a/hooks/checkout b/hooks/checkout index 76d3a82..120108b 100755 --- a/hooks/checkout +++ b/hooks/checkout @@ -39,8 +39,10 @@ if [ "${DRY_RUN}" != "true" ]; then git fetch -v --prune -- origin "refs/heads/${BUILDKITE_BRANCH}" fi - # Checkout the SHA - if [ "${BUILDKITE_COMMIT:-}" != "" ]; then + # Checkout the correct ref to continue the build + if [ "${BUILDKITE_COMMIT:-}" = "HEAD" ] || [ "${BUILDKITE_COMMIT}" = "" ]; then + git checkout -f "origin/${BUILDKITE_BRANCH}" + else git checkout -f "${BUILDKITE_COMMIT}" fi fi