Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit c77b1dc

Browse files
authored
Merge pull request #63 from aserto-dev/mitza/fix_sver
Enable sver to work with safe directory
2 parents d350f15 + ca6418f commit c77b1dc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

gh-action-entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ set -e
33

44
export PRE_RELEASE="$INPUT_PRE_RELEASE"
55

6+
if [ -n ${GITHUB_WORKSPACE} ]; then
7+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
8+
fi
9+
610
if [ -n "${INPUT_DOCKER_IMAGE}" ]; then
711
version=$(/app/sver tags -s "${INPUT_DOCKER_REGISTRY}" -u "${INPUT_DOCKER_USERNAME}" -p "${INPUT_DOCKER_PASSWORD}" "${INPUT_DOCKER_IMAGE}")
812
elif [ -n "${INPUT_NEXT}" ]; then

pkg/sver/git.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package sver
22

33
import (
4+
"bytes"
45
"os/exec"
56
"strings"
67

@@ -24,9 +25,11 @@ func verifyGit() error {
2425
}
2526

2627
cmd := exec.Command(gitBinary, "rev-parse", "--is-inside-work-tree")
28+
stdErrBuf := new(bytes.Buffer)
29+
cmd.Stderr = stdErrBuf
2730
err = cmd.Run()
2831
if err != nil {
29-
return errors.New("current directory is not a git working tree")
32+
return errors.Wrapf(err, "could not determine if the current directory is a git working tree: %s", stdErrBuf.String())
3033
}
3134

3235
return nil

0 commit comments

Comments
 (0)