Skip to content

Increase timeout for uploading to GitHub #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ s3Upload := {
ghUpload := {
import sttp.client3._
import _root_.io.circe._, _root_.io.circe.parser._
import scala.concurrent.duration._

val log = streams.value.log
val ghRelease = s"v${(Universal / version).value}"
Expand All @@ -65,15 +66,16 @@ ghUpload := {
log.info(s"Uploading ${file.getAbsolutePath} as ${file.getName} to https://github.com/scala/scala/releases/tag/$ghRelease")

// https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset
val request = basicRequest
val response = basicRequest
.post(uri"https://uploads.github.com/repos/scala/scala/releases/${releaseId}/assets?name=${file.getName}")
.contentType("application/octet-stream")
.header("Accept", "application/vnd.github+json")
.header("Authorization", s"Bearer $token")
.header("X-GitHub-Api-Version", "2022-11-28")
.body(file)
.readTimeout(15.minutes) // .deb is 650+ MB (API docs are not zipped... scala/scala-dist#189)
.send(backend)

val response = request.send(backend)
if (response.code.code != 201)
throw new MessageOnlyException(s"Upload failed: status=${response.code}\n${response.body}")
}
Expand Down