Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 8787f0b

Browse files
authored
Merge pull request #165 from sauyon/support-actions
autobuilder: Add support for GITHUB_REPOSITORY environment variable
2 parents 4cd3f89 + ba0f922 commit 8787f0b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This behavior can be further customized using environment variables: setting LGT
3333
to 'false' disables the GOPATH set-up, CODEQL_EXTRACTOR_GO_BUILD_COMMAND (or alternatively
3434
LGTM_INDEX_BUILD_COMMAND), can be set to a newline-separated list of commands to run in order to
3535
install dependencies, and LGTM_INDEX_IMPORT_PATH can be used to override the package import path,
36-
which is otherwise inferred from the SEMMLE_REPO_URL environment variable.
36+
which is otherwise inferred from the SEMMLE_REPO_URL or GITHUB_REPOSITORY environment variables.
3737
3838
In resource-constrained environments, the environment variable CODEQL_EXTRACTOR_GO_MAX_GOROUTINES
3939
(or its legacy alias SEMMLE_MAX_GOROUTINES) can be used to limit the number of parallel goroutines
@@ -92,9 +92,15 @@ func getImportPath() (importpath string) {
9292
if importpath == "" {
9393
repourl := os.Getenv("SEMMLE_REPO_URL")
9494
if repourl == "" {
95-
return ""
95+
githubrepo := os.Getenv("GITHUB_REPOSITORY")
96+
if githubrepo == "" {
97+
return ""
98+
} else {
99+
importpath = "github.com/" + githubrepo
100+
}
101+
} else {
102+
importpath = getImportPathFromRepoURL(repourl)
96103
}
97-
importpath = getImportPathFromRepoURL(repourl)
98104
}
99105
log.Printf("Import path is %s\n", importpath)
100106
return

0 commit comments

Comments
 (0)