Skip to content

Commit

Permalink
[ci] add proxy support for url request
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and sequencer committed Jan 12, 2025
1 parent 5dd37b7 commit da6d544
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,17 @@ object Main:
def findCurrentJobURL() =
val runID = sys.env("GITHUB_RUN_ID")
val jobName = sys.env("GITHUB_JOB_NAME")
Logger.info(s"Getting URL for Run ID: ${runID}, job '${jobName}'")
val proxy: (String, Int) = sys.env.get("https_proxy")
.map(proxy => new java.net.URI(proxy))
.map(uri => (uri.getHost, uri.getPort))
.getOrElse(null)

val response = requests.get.stream(s"https://api.github.com/repos/chipsalliance/t1/actions/runs/${runID}/jobs")
Logger.info(s"Getting URL for Run ID: ${runID}, job '${jobName}'")
val session = requests.Session(
headers = Map("User-Agent" -> "Mozilla/5.0 (X11; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0"),
proxy = proxy,
)
val response = session.get.stream(s"https://api.github.com/repos/chipsalliance/t1/actions/runs/${runID}/jobs")
val ciData = ujson.read(response)
ciData
.obj("jobs")
Expand Down

0 comments on commit da6d544

Please sign in to comment.