diff --git a/action.yml b/action.yml index 7f301cd..7487391 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ inputs: runs: using: 'docker' - image: 'docker://stackit-solutions.git.onstackit.cloud/actions/notify:v0.1.2' + image: 'docker://stackit-solutions.git.onstackit.cloud/actions/notify-slim:v0.1.2' # image: 'Dockerfile' args: - ${{ inputs.project }} diff --git a/docker-slimbuild b/docker-slimbuild index bdc6e01..6a8459c 100644 --- a/docker-slimbuild +++ b/docker-slimbuild @@ -1,14 +1,15 @@ -FROM golang:1.13 AS builder +FROM golang:1.26 AS builder RUN apt-get update && apt-get -y install upx +WORKDIR /app #RUN mkdir -p $GOPATH/src/github.com/DTherHtun/google-chat-action #ADD . $GOPATH/src/github.com/DTherHtun/google-chat-action -RUN go get -u github.com/sethvargo/go-githubactions/... +# RUN go get -u github.com/sethvargo/go-githubactions/... ENV CGO_ENABLED=0 COPY . . -RUN go build \ +RUN go mod tidy && go build \ -a \ -trimpath \ -ldflags "-s -w -extldflags '-static'" \ diff --git a/main.go b/main.go index fa3fe7d..12cb578 100644 --- a/main.go +++ b/main.go @@ -31,6 +31,7 @@ type templateData struct { Status string ActionID string GitURL string + Project string Color string Add string EventBody string @@ -41,6 +42,11 @@ func main() { data.CardID = uuid.NewString() data.Add = "" + prj, ok := os.LookupEnv("FORGEJO_REPOSITORY") + if ok { + data.Project = prj + } + author := githubactions.GetInput("author") if author == "" { githubactions.Infof("[INFO] Missing input 'author', using default") @@ -150,9 +156,8 @@ func card(d templateData) ([]byte, error) { if d.EventBody == "" { bdy := "" - prj, ok := os.LookupEnv("FORGEJO_REPOSITORY") - if ok { - bdy += fmt.Sprintf("Project: %s
", prj) + if d.Project != "" { + bdy += fmt.Sprintf("Project: %s
", d.Project) } sha, ok := os.LookupEnv("FORGEJO_SHA")