Skip to content

Commit

Permalink
get server url from github context
Browse files Browse the repository at this point in the history
  • Loading branch information
sailorlqh committed Oct 30, 2024
1 parent 12405cb commit ae68208
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
githubContextEventKey = "event"
githubContextEventURLKey = "html_url"
githubEventContenntCreatedAtKey = "created_at"
githubContextServerURLKey = "server_url"
)

const (
Expand Down Expand Up @@ -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),
}
Expand Down

0 comments on commit ae68208

Please sign in to comment.