@@ -4,6 +4,12 @@ import (
4
4
"context"
5
5
"encoding/base64"
6
6
"fmt"
7
+ "log"
8
+ net "net/http"
9
+ "os"
10
+ "strings"
11
+ "time"
12
+
7
13
"github.com/bradleyfalzon/ghinstallation/v2"
8
14
"github.com/diggerhq/digger/backend/models"
9
15
"github.com/diggerhq/digger/libs/ci"
@@ -13,11 +19,6 @@ import (
13
19
"github.com/go-git/go-git/v5/plumbing"
14
20
"github.com/go-git/go-git/v5/plumbing/transport/http"
15
21
"github.com/google/go-github/v61/github"
16
- "log"
17
- net "net/http"
18
- "os"
19
- "strings"
20
- "time"
21
22
)
22
23
23
24
func createTempDir () string {
@@ -211,6 +212,14 @@ func SetPRStatusForJobs(prService ci.PullRequestService, prNumber int, jobs []sc
211
212
return nil
212
213
}
213
214
215
+ func GetGithubHostname () string {
216
+ githubHostname := os .Getenv ("DIGGER_GITHUB_HOSTNAME" )
217
+ if githubHostname == "" {
218
+ githubHostname = "github.com"
219
+ }
220
+ return githubHostname
221
+ }
222
+
214
223
func GetWorkflowIdAndUrlFromDiggerJobId (client * github.Client , repoOwner string , repoName string , diggerJobID string ) (int64 , string , error ) {
215
224
timeFilter := time .Now ().Add (- 5 * time .Minute )
216
225
runs , _ , err := client .Actions .ListRepositoryWorkflowRuns (context .Background (), repoOwner , repoName , & github.ListWorkflowRunsOptions {
@@ -230,7 +239,7 @@ func GetWorkflowIdAndUrlFromDiggerJobId(client *github.Client, repoOwner string,
230
239
for _ , workflowjob := range workflowjobs .Jobs {
231
240
for _ , step := range workflowjob .Steps {
232
241
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
234
243
}
235
244
}
236
245
0 commit comments