diff --git a/act/runner/run_context_test.go b/act/runner/run_context_test.go index 110afb45..33739b52 100644 --- a/act/runner/run_context_test.go +++ b/act/runner/run_context_test.go @@ -280,6 +280,40 @@ func TestRunContext_GetBindsAndMounts(t *testing.T) { }) } +func TestRunContext_GetGithubContextURL(t *testing.T) { + table := []struct { + instance string + serverUrl string + APIUrl string + }{ + {instance: "", serverUrl: "", APIUrl: "/api/v1"}, + {instance: "example.com", serverUrl: "https://example.com", APIUrl: "https://example.com/api/v1"}, + {instance: "http://example.com", serverUrl: "http://example.com", APIUrl: "http://example.com/api/v1"}, + {instance: "https://example.com", serverUrl: "https://example.com", APIUrl: "https://example.com/api/v1"}, + } + for _, data := range table { + t.Run(data.instance, func(t *testing.T) { + rc := &RunContext{ + EventJSON: "{}", + Config: &Config{ + GitHubInstance: data.instance, + }, + Run: &model.Run{ + Workflow: &model.Workflow{ + Name: "GitHubContextTest", + }, + }, + } + + ghc := rc.getGithubContext(t.Context()) + + assert.Equal(t, data.serverUrl, ghc.ServerURL) + assert.Equal(t, data.APIUrl, ghc.APIURL) + }) + + } +} + func TestRunContext_GetGithubContextRef(t *testing.T) { table := []struct { event string