Skip to content

Commit

Permalink
Merge pull request #5 from xmtp-labs/add-safe-directory
Browse files Browse the repository at this point in the history
Git permissions issues
  • Loading branch information
neekolas committed Feb 13, 2023
2 parents f8ac7d4 + bec00a1 commit d68f109
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ARG GO_VERSION=1.19
FROM golang:${GO_VERSION}-alpine
WORKDIR /app
RUN apk add --no-cache git
RUN git config --system --add safe.directory '*'
COPY go.mod .
COPY go.sum .
RUN go mod download
Expand Down
5 changes: 3 additions & 2 deletions cmd/deploy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
log.Fatal("Invalid options", zap.Error(err))
}

runTitle, err := getRunTitle(opts)
runTitle, err := getRunTitle(opts, log)
if err != nil {
log.Fatal("Could not get run title", zap.Error(err))
}
Expand Down Expand Up @@ -67,13 +67,14 @@ func getDeployer(token, organization, workspace string, log *zap.Logger) (*deplo
})
}

func getRunTitle(opts options.Options) (string, error) {
func getRunTitle(opts options.Options, log *zap.Logger) (string, error) {
if opts.RunTitle != "" {
return opts.RunTitle, nil
}

out, err := exec.Command("git", "log", "--oneline", "-n 1").Output()
if err != nil {
log.Error("git log failed", zap.String("output", string(out)))
return "", err
}

Expand Down

0 comments on commit d68f109

Please sign in to comment.