Skip to content

Commit

Permalink
feat: Get server url from github context (#19)
Browse files Browse the repository at this point in the history
fixes: #17
  • Loading branch information
sailorlqh authored Oct 30, 2024
1 parent 12405cb commit 2173622
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 2173622

Please sign in to comment.