Skip to content

Commit 88a1a29

Browse files
authored
Merge pull request #667 from 47degrees/gb-scala3
Update to CE3 and scala3
2 parents 9e8c7bb + 56e2675 commit 88a1a29

37 files changed

Lines changed: 561 additions & 852 deletions

.scalafmt.conf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
version = 2.7.5
1+
version = 3.0.0-RC5
2+
23
style = defaultWithAlign
34
maxColumn = 100
45

@@ -15,7 +16,8 @@ align {
1516
openParenDefnSite = false
1617
}
1718

18-
docstrings = JavaDoc
19+
docstrings.style = Asterisk
20+
docstrings.wrap = no
1921

2022
rewrite {
2123
rules = [SortImports, RedundantBraces]

AUTHORS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
The maintainers of the project are:
1010

11-
- [![bond15](https://avatars.githubusercontent.com/u/9124653?v=4&s=20) **bond15**](https://github.com/bond15)
1211
- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
1312
- [![AdrianRaFo](https://avatars.githubusercontent.com/u/15971742?v=4&s=20) **Adrian Ramirez Fornell (AdrianRaFo)**](https://github.com/AdrianRaFo)
1413
- [![alejandrohdezma](https://avatars.githubusercontent.com/u/9027541?v=4&s=20) **Alejandro Hernández (alejandrohdezma)**](https://github.com/alejandrohdezma)
@@ -30,15 +29,15 @@ The maintainers of the project are:
3029

3130
These are the people that have contributed to the _github4s_ project:
3231

32+
- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
3333
- [![BenFradet](https://avatars.githubusercontent.com/u/1737211?v=4&s=20) **BenFradet**](https://github.com/BenFradet)
3434
- [![juanpedromoreno](https://avatars.githubusercontent.com/u/4879373?v=4&s=20) **juanpedromoreno**](https://github.com/juanpedromoreno)
35-
- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
3635
- [![rafaparadela](https://avatars.githubusercontent.com/u/315070?v=4&s=20) **rafaparadela**](https://github.com/rafaparadela)
3736
- [![47degdev](https://avatars.githubusercontent.com/u/5580770?v=4&s=20) **47degdev**](https://github.com/47degdev)
3837
- [![fedefernandez](https://avatars.githubusercontent.com/u/720923?v=4&s=20) **fedefernandez**](https://github.com/fedefernandez)
38+
- [![sloshy](https://avatars.githubusercontent.com/u/427237?v=4&s=20) **sloshy**](https://github.com/sloshy)
3939
- [![jdesiloniz](https://avatars.githubusercontent.com/u/2835739?v=4&s=20) **jdesiloniz**](https://github.com/jdesiloniz)
4040
- [![anamariamv](https://avatars.githubusercontent.com/u/2183589?v=4&s=20) **anamariamv**](https://github.com/anamariamv)
41-
- [![sloshy](https://avatars.githubusercontent.com/u/427237?v=4&s=20) **sloshy**](https://github.com/sloshy)
4241
- [![calvellido](https://avatars.githubusercontent.com/u/7753447?v=4&s=20) **calvellido**](https://github.com/calvellido)
4342
- [![AdrianRaFo](https://avatars.githubusercontent.com/u/15971742?v=4&s=20) **AdrianRaFo**](https://github.com/AdrianRaFo)
4443
- [![alejandrohdezma](https://avatars.githubusercontent.com/u/9027541?v=4&s=20) **alejandrohdezma**](https://github.com/alejandrohdezma)
@@ -69,6 +68,7 @@ These are the people that have contributed to the _github4s_ project:
6968
- [![MaureenElsberry](https://avatars.githubusercontent.com/u/17556002?v=4&s=20) **MaureenElsberry**](https://github.com/MaureenElsberry)
7069
- [![mikegirkin](https://avatars.githubusercontent.com/u/4907402?v=4&s=20) **mikegirkin**](https://github.com/mikegirkin)
7170
- [![peterneyens](https://avatars.githubusercontent.com/u/6407606?v=4&s=20) **peterneyens**](https://github.com/peterneyens)
71+
- [![PeterPerhac](https://avatars.githubusercontent.com/u/1763911?v=4&s=20) **PeterPerhac**](https://github.com/PeterPerhac)
7272
- [![raulraja](https://avatars.githubusercontent.com/u/456796?v=4&s=20) **raulraja**](https://github.com/raulraja)
7373
- [![satorg](https://avatars.githubusercontent.com/u/3954178?v=4&s=20) **satorg**](https://github.com/satorg)
7474
- [![suhasgaddam](https://avatars.githubusercontent.com/u/7282584?v=4&s=20) **suhasgaddam**](https://github.com/suhasgaddam)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-0.28.1-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-0.28.1-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)
2+
[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-0.28.5-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-0.28.5-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)
33

44
Github4s
55
=============
@@ -11,7 +11,7 @@ Github4s
1111
To get started with SBT, simply add the following to your build.sbt file.
1212

1313
```scala
14-
libraryDependencies += "com.47deg" %% "github4s" % "0.28.1"
14+
libraryDependencies += "com.47deg" %% "github4s" % "0.28.5"
1515
```
1616

1717
## Github4s in the wild
@@ -21,6 +21,7 @@ If you wish to add your library here please consider a PR to include it in the l
2121
★ | ★ | ★
2222
--- | --- | ---
2323
![scala-exercises](https://www.scala-exercises.org/assets/images/navbar_brand.svg) | [**scala-exercises**](https://www.scala-exercises.org/) | Scala Exercises is an Open Source project for learning different technologies based in the Scala Programming Language.
24+
| | [**dashing**](https://github.com/benfradet/dashing) | Dashing is a collection of dashboards to monitor the health of an open source organization.
2425
| | [**cla-bot**](https://github.com/snowplow-incubator/cla-bot) | Bot making sure external contributors sign a CLA.
2526

2627
# Copyright

build.sbt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
import ProjectPlugin.on
2+
13
ThisBuild / organization := "com.47deg"
2-
ThisBuild / scalaVersion := "2.13.2"
3-
ThisBuild / crossScalaVersions := Seq("2.12.12", "2.13.4")
44

5-
addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; testCovered")
5+
val scala212 = "2.12.14"
6+
val scala213 = "2.13.6"
7+
val scala3Version = "3.0.0"
8+
val scala2Versions = Seq(scala212, scala213)
9+
val allScalaVersions = scala2Versions :+ scala3Version
10+
ThisBuild / scalaVersion := scala213
11+
ThisBuild / crossScalaVersions := allScalaVersions
12+
13+
addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; ++test")
614
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; publishMicrosite")
715
addCommandAlias("ci-publish", "github; ci-release")
816

9-
skip in publish := true
17+
publish / skip := true
1018

11-
lazy val github4s = project.settings(coreDeps: _*)
19+
lazy val github4s = project
20+
.settings(coreDeps: _*)
21+
.settings(
22+
// Increase number of inlines, needed for circe semiauto derivation
23+
scalacOptions ++= on(3, 9)(Seq("-Xmax-inlines", "20")).value.flatten
24+
)
1225

1326
//////////
1427
// DOCS //
@@ -19,10 +32,10 @@ lazy val microsite: Project = project
1932
.enablePlugins(MicrositesPlugin)
2033
.enablePlugins(ScalaUnidocPlugin)
2134
.settings(micrositeSettings: _*)
22-
.settings(skip in publish := true)
23-
.settings(unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(github4s, microsite))
35+
.settings(publish / skip := true)
36+
.settings(ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(github4s, microsite))
2437

2538
lazy val documentation = project
2639
.enablePlugins(MdocPlugin)
2740
.settings(mdocOut := file("."))
28-
.settings(skip in publish := true)
41+
.settings(publish / skip := true)

github4s/src/main/scala/github4s/GHError.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ object GHError {
143143

144144
sealed trait ErrorCode
145145
object ErrorCode {
146-
final case object MissingResource extends ErrorCode
147-
final case object MissingField extends ErrorCode
148-
final case object InvalidFormatting extends ErrorCode
149-
final case object ResourceAlreadyExists extends ErrorCode
150-
final case object Custom extends ErrorCode
146+
case object MissingResource extends ErrorCode
147+
case object MissingField extends ErrorCode
148+
case object InvalidFormatting extends ErrorCode
149+
case object ResourceAlreadyExists extends ErrorCode
150+
case object Custom extends ErrorCode
151151
private[github4s] implicit val errorCodeDecoder: Decoder[ErrorCode] =
152152
Decoder.decodeString.map {
153153
case "missing" => MissingResource

github4s/src/main/scala/github4s/Github.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
package github4s
1818

19-
import cats.effect.Sync
19+
import cats.effect.kernel.Concurrent
2020
import github4s.algebras._
2121
import github4s.interpreters.StaticAccessToken
2222
import github4s.modules._
2323
import org.http4s.client.Client
2424

25-
class Github[F[_]: Sync](
25+
class Github[F[_]: Concurrent](
2626
client: Client[F],
2727
accessToken: AccessToken[F]
2828
)(implicit config: GithubConfig)
@@ -45,7 +45,7 @@ class Github[F[_]: Sync](
4545

4646
object Github {
4747

48-
def apply[F[_]: Sync](
48+
def apply[F[_]: Concurrent](
4949
client: Client[F],
5050
accessToken: Option[String] = None
5151
)(implicit config: GithubConfig): Github[F] =

github4s/src/main/scala/github4s/GithubConfig.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package github4s
1818

1919
import org.http4s.Header
20+
import org.typelevel.ci.CIString
2021

2122
/**
2223
* Configuration for github4s
@@ -31,7 +32,9 @@ final case class GithubConfig(
3132
accessTokenUrl: String,
3233
headers: Map[String, String]
3334
) {
34-
def toHeaderList: List[Header] = headers.map { case (k, v) => Header(k, v) }.toList
35+
def toHeaderList: List[Header.Raw] = headers.map { case (k, v) =>
36+
Header.Raw(CIString(k), v)
37+
}.toList
3538
}
3639

3740
object GithubConfig {

github4s/src/main/scala/github4s/GithubIOSyntax.scala

Lines changed: 0 additions & 42 deletions
This file was deleted.

github4s/src/main/scala/github4s/algebras/AccessToken.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ import github4s.GHResponse
2121
/**
2222
* Source of static or expiring github tokens
2323
*
24-
* For github app authentication you'd want to create a token source
25-
* which calls github's installation authentication api with a jwt token, generated from a private key
26-
* These tokens have a 1h lifetime, so it's a good idea to handle expired tokens here as well
24+
* For github app authentication you'd want to create a token source which calls github's
25+
* installation authentication api with a jwt token, generated from a private key These tokens have
26+
* a 1h lifetime, so it's a good idea to handle expired tokens here as well
2727
*
28-
* @see https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps
28+
* @see
29+
* https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps
2930
*/
3031
trait AccessToken[F[_]] {
3132

github4s/src/main/scala/github4s/algebras/GitData.scala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ trait GitData[F[_]] {
7777
* @param ref ref formatted as heads/branch
7878
* @param sha the SHA1 value to set this reference to
7979
* @param force Indicates whether to force the update or to make sure the update is a fast-forward update.
80-
* Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`
80+
* Leaving this out or setting it to `false` will make sure you're not overwriting work.
81+
* Default: `false`
8182
* @param headers optional user headers to include in the request
8283
* @return a GHResponse with the Ref
8384
*/
@@ -196,14 +197,14 @@ trait GitData[F[_]] {
196197
* @param repo name of the repo
197198
* @param baseTree the SHA1 of the tree you want to update with new data.
198199
* @param treeDataList list (of path, mode, type, and sha/blob) specifying a tree structure:
199-
* - path: The file referenced in the tree
200-
* - mode: The file mode; one of 100644 for file (blob), 100755 for executable (blob),
201-
* 040000 for subdirectory (tree), 160000 for submodule (commit),
202-
* or 120000 for a blob that specifies the path of a symlink
203-
* - type string Either blob, tree, or commit
204-
* - sha string The SHA1 checksum ID of the object in the tree
205-
* - content string The content you want this file to have.
206-
* GitHub will write this blob out and use that SHA for this entry. Use either this, or tree.sha.
200+
* - path: The file referenced in the tree
201+
* - mode: The file mode; one of 100644 for file (blob), 100755 for executable (blob),
202+
* 040000 for subdirectory (tree), 160000 for submodule (commit),
203+
* or 120000 for a blob that specifies the path of a symlink
204+
* - type string Either blob, tree, or commit
205+
* - sha string The SHA1 checksum ID of the object in the tree
206+
* - content string The content you want this file to have.
207+
* GitHub will write this blob out and use that SHA for this entry. Use either this, or tree.sha.
207208
* @param headers optional user headers to include in the request
208209
* @return a GHResponse with TreeResult
209210
*/

0 commit comments

Comments
 (0)