@@ -4,6 +4,12 @@ import (
44 "context"
55 "encoding/base64"
66 "fmt"
7+ "log"
8+ net "net/http"
9+ "os"
10+ "strings"
11+ "time"
12+
713 "github.com/bradleyfalzon/ghinstallation/v2"
814 "github.com/diggerhq/digger/backend/models"
915 "github.com/diggerhq/digger/libs/ci"
@@ -13,11 +19,6 @@ import (
1319 "github.com/go-git/go-git/v5/plumbing"
1420 "github.com/go-git/go-git/v5/plumbing/transport/http"
1521 "github.com/google/go-github/v61/github"
16- "log"
17- net "net/http"
18- "os"
19- "strings"
20- "time"
2122)
2223
2324func createTempDir () string {
@@ -211,6 +212,14 @@ func SetPRStatusForJobs(prService ci.PullRequestService, prNumber int, jobs []sc
211212 return nil
212213}
213214
215+ func GetGithubHostname () string {
216+ githubHostname := os .Getenv ("DIGGER_GITHUB_HOSTNAME" )
217+ if githubHostname == "" {
218+ githubHostname = "github.com"
219+ }
220+ return githubHostname
221+ }
222+
214223func GetWorkflowIdAndUrlFromDiggerJobId (client * github.Client , repoOwner string , repoName string , diggerJobID string ) (int64 , string , error ) {
215224 timeFilter := time .Now ().Add (- 5 * time .Minute )
216225 runs , _ , err := client .Actions .ListRepositoryWorkflowRuns (context .Background (), repoOwner , repoName , & github.ListWorkflowRunsOptions {
@@ -230,7 +239,7 @@ func GetWorkflowIdAndUrlFromDiggerJobId(client *github.Client, repoOwner string,
230239 for _ , workflowjob := range workflowjobs .Jobs {
231240 for _ , step := range workflowjob .Steps {
232241 if strings .Contains (* step .Name , diggerJobID ) {
233- return * workflowRun .ID , fmt .Sprintf ("https://github.com /%v/%v/actions/runs/%v" , repoOwner , repoName , * workflowRun .ID ), nil
242+ return * workflowRun .ID , fmt .Sprintf ("https://%v /%v/%v/actions/runs/%v" , GetGithubHostname () , repoOwner , repoName , * workflowRun .ID ), nil
234243 }
235244 }
236245
0 commit comments