@@ -34,7 +34,7 @@ This behavior can be further customized using environment variables: setting LGT
3434to 'false' disables the GOPATH set-up, CODEQL_EXTRACTOR_GO_BUILD_COMMAND (or alternatively
3535LGTM_INDEX_BUILD_COMMAND), can be set to a newline-separated list of commands to run in order to
3636install dependencies, and LGTM_INDEX_IMPORT_PATH can be used to override the package import path,
37- which is otherwise inferred from the SEMMLE_REPO_URL environment variable .
37+ which is otherwise inferred from the SEMMLE_REPO_URL or GITHUB_REPOSITORY environment variables .
3838
3939In resource-constrained environments, the environment variable CODEQL_EXTRACTOR_GO_MAX_GOROUTINES
4040(or its legacy alias SEMMLE_MAX_GOROUTINES) can be used to limit the number of parallel goroutines
@@ -100,13 +100,19 @@ func getImportPath() (importpath string) {
100100 if importpath == "" {
101101 repourl := os .Getenv ("SEMMLE_REPO_URL" )
102102 if repourl == "" {
103- log .Printf ("Unable to determine import path, as neither LGTM_INDEX_IMPORT_PATH nor SEMMLE_REPO_URL is set\n " )
104- return ""
105- }
106- importpath = getImportPathFromRepoURL (repourl )
107- if importpath == "" {
108- log .Printf ("Failed to determine import path from SEMMLE_REPO_URL '%s'\n " , repourl )
109- return
103+ githubrepo := os .Getenv ("GITHUB_REPOSITORY" )
104+ if githubrepo == "" {
105+ log .Printf ("Unable to determine import path, as neither LGTM_INDEX_IMPORT_PATH nor GITHUB_REPOSITORY is set\n " )
106+ return ""
107+ } else {
108+ importpath = "github.com/" + githubrepo
109+ }
110+ } else {
111+ importpath = getImportPathFromRepoURL (repourl )
112+ if importpath == "" {
113+ log .Printf ("Failed to determine import path from SEMMLE_REPO_URL '%s'\n " , repourl )
114+ return
115+ }
110116 }
111117 }
112118 log .Printf ("Import path is '%s'\n " , importpath )
0 commit comments