Skip to content

Commit 4ce3c4b

Browse files
author
Juan José Vázquez
committed
wip gitlab: adapts the release process to Gitlab
1 parent 07a424d commit 4ce3c4b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

core/src/main/scala/Config.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ object Config {
784784
cfg.require[String]("client-secret"),
785785
cfg.require[String]("redirect-uri"),
786786
cfg.require[String]("scope"),
787-
AccessToken(cfg.require[String]("access-token")),
787+
AccessToken(cfg.require[String]("access-token"), isPrivate = true),
788788
cfg.require[String]("system-username"),
789789
cfg.lookup[List[String]]("organization-blacklist").getOrElse(Nil),
790790
cfg.lookup[List[String]]("organization-admins").getOrElse(Nil)

core/src/main/scala/Gitlab.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ object Gitlab {
113113
}.flatMap { release =>
114114
if (release.assets.isEmpty)
115115
Task.fail(new IllegalArgumentException(
116-
s"The tag `$releaseId` for repo `$slug` is not a valid release. " +
116+
s"The tag '$releaseId' for repo '$slug' is not a valid release. " +
117117
"Have you added an asset as release description?"
118118
))
119119
else

core/src/main/scala/Json.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ object Json {
258258
*/
259259
implicit lazy val GithubEventDecoder: DecodeJson[Github.Event] =
260260
GithubReleaseEventDecoder.asInstanceOf[DecodeJson[Github.ReleaseEvent]] |||
261+
GitlabReleaseEventDecoder.asInstanceOf[DecodeJson[Github.ReleaseEvent]] |||
261262
GithubPingEventDecoder.asInstanceOf[DecodeJson[Github.Event]]
262263

263264
/**
@@ -514,6 +515,16 @@ object Json {
514515
)
515516
})
516517

518+
implicit val GitlabReleaseEventDecoder: DecodeJson[Github.ReleaseEvent] =
519+
DecodeJson(z => for {
520+
a <- (z --\ "ref").as[String]
521+
i = a.split('/').last
522+
p <- (z --\ "project" --\ "path_with_namespace").as[String]
523+
x <- Slug.fromString(p).map(DecodeResult.ok
524+
).valueOr(e => DecodeResult.fail(e.getMessage,z.history))
525+
e <- (z --\ "project_id").as[Long]
526+
} yield Github.ReleaseEvent(id = i, slug = x, repositoryId = e))
527+
517528
/**
518529
* {
519530
* "url": "https://github.example.com/api/v3/repos/example/howdy/releases/assets/1",

0 commit comments

Comments
 (0)