Allow using environment variables for project url and commit.
parent
d2db077fc4
commit
c29c914910
|
@ -49,6 +49,9 @@ def getGithubBaseUrl (gitUrl : String) : String := Id.run do
|
||||||
Obtain the Github URL of a project by parsing the origin remote.
|
Obtain the Github URL of a project by parsing the origin remote.
|
||||||
-/
|
-/
|
||||||
def getProjectGithubUrl (directory : System.FilePath := ".") : IO String := do
|
def getProjectGithubUrl (directory : System.FilePath := ".") : IO String := do
|
||||||
|
match (<- IO.getEnv "GIT_ORIGIN_URL") with
|
||||||
|
| some url => return url
|
||||||
|
| none =>
|
||||||
let out ← IO.Process.output {
|
let out ← IO.Process.output {
|
||||||
cmd := "git",
|
cmd := "git",
|
||||||
args := #["remote", "get-url", "origin"],
|
args := #["remote", "get-url", "origin"],
|
||||||
|
@ -62,6 +65,9 @@ def getProjectGithubUrl (directory : System.FilePath := "." ) : IO String := do
|
||||||
Obtain the git commit hash of the project that is currently getting analyzed.
|
Obtain the git commit hash of the project that is currently getting analyzed.
|
||||||
-/
|
-/
|
||||||
def getProjectCommit (directory : System.FilePath := ".") : IO String := do
|
def getProjectCommit (directory : System.FilePath := ".") : IO String := do
|
||||||
|
match (<- IO.getEnv "GIT_REVISION") with
|
||||||
|
| some rev => return rev
|
||||||
|
| none =>
|
||||||
let out ← IO.Process.output {
|
let out ← IO.Process.output {
|
||||||
cmd := "git",
|
cmd := "git",
|
||||||
args := #["rev-parse", "HEAD"]
|
args := #["rev-parse", "HEAD"]
|
||||||
|
|
Loading…
Reference in New Issue