From 21736222f072d3b7f252ea778ff7098d7aabe85a Mon Sep 17 00:00:00 2001 From: Qinhang Li Date: Wed, 30 Oct 2024 13:02:16 -0700 Subject: [PATCH] feat: Get server url from github context (#19) fixes: #17 --- src/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.go b/src/main.go index 1b9aa74..865530d 100644 --- a/src/main.go +++ b/src/main.go @@ -40,6 +40,7 @@ const ( githubContextEventKey = "event" githubContextEventURLKey = "html_url" githubEventContenntCreatedAtKey = "created_at" + githubContextServerURLKey = "server_url" ) const ( @@ -238,7 +239,7 @@ func generateMessageBodyContent(ghJSON, jobJSON map[string]any, currentTimeStamp // The key for getting timestamp is different in differnet triggering event // a simple work around is using the new timestamp. timestamp: currentTimeStamp.UTC().Format(time.RFC3339), - clickURL: fmt.Sprintf("https://github.com/%s/actions/runs/%s", getMapFieldStringValue(ghJSON, githubContextRepositoryKey), getMapFieldStringValue(ghJSON, "run_id")), + clickURL: fmt.Sprintf("%s/%s/actions/runs/%s", getMapFieldStringValue(ghJSON, githubContextServerURLKey), getMapFieldStringValue(ghJSON, githubContextRepositoryKey), getMapFieldStringValue(ghJSON, "run_id")), eventName: "workflow", repo: getMapFieldStringValue(ghJSON, githubContextRepositoryKey), }