Skip to content

Commit ca3a75e

Browse files
Merge pull request #478 from alejandrohdezma/feature/default-branch
Add information about repository's default branch
2 parents 35edc5e + 702221c commit ca3a75e

File tree

17 files changed

+44
-31
lines changed

17 files changed

+44
-31
lines changed

docs/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# @DESCRIPTION@
22

3-
[![][maven-badge]][maven] [![][steward-badge]][steward]
4-
53
This plugin enables several settings automatically by downloading them from Github:
64

75
- `homepage`: Retrieved from the Github repository's information.
@@ -33,10 +31,4 @@ If you want to know more about all the plugin's features, please head on to [its
3331

3432
## Contributors for this project
3533

36-
@CONTRIBUTORS_TABLE@
37-
38-
[maven]: https://search.maven.org/search?q=g:%20com.alejandrohdezma%20AND%20a:sbt-github
39-
[maven-badge]: https://maven-badges.herokuapp.com/maven-central/com.alejandrohdezma/sbt-github/badge.svg?kill_cache=1
40-
41-
[steward]: https://scala-steward.org
42-
[steward-badge]: https://img.shields.io/badge/Scala_Steward-helping-brightgreen.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=
34+
@CONTRIBUTORS_TABLE@

modules/sbt-github-mdoc/src/main/scala/com/alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import mdoc.MdocPlugin.autoImport.mdocVariables
4545
* - '''ORG_URL''': Set to the value of `organizationHomepage` setting (Github's organization homepage, or owner's in
4646
* case organization is empty and `populateOrganizationWithOwner` is `true`).
4747
* - '''REPO''': Set to the repository's path: "owner/repo".
48+
* - '''DEFAULT_BRANCH''': Set to the repository's default branch.
4849
* - '''START_YEAR''': Set to the value of the `startYear` setting.
4950
* - '''YEAR_RANGE''': Set to the value of the `yearRange` setting
5051
* - '''COPYRIGHT_OWNER''': Set to the value of `ORG_NAME <ORG_URL>` if `ORG_URL` is present or just `ORG_NAME` in
@@ -88,6 +89,7 @@ object SbtGithubMdocPlugin extends AutoPlugin {
8889
mdocVariables ++= Map(
8990
"NAME" -> displayName.value,
9091
"REPO" -> repository.value.map(_.name).getOrElse(""),
92+
"DEFAULT_BRANCH" -> repository.value.map(_.defaultBranch).getOrElse(""),
9193
"LICENSE" -> licenses.value.headOption.map(_._1).getOrElse(""),
9294
"ORG_NAME" -> organizationName.value,
9395
"DESCRIPTION" -> description.value,

modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/remove-version-timestamp/github/repository.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "repo",
33
"full_name": "user1/repo",
44
"created_at": "2018-01-01T13:30:30Z",
5+
"default_branch": "name",
56
"owner": {
67
"url": "{{base_directory}}/user1.json"
78
},

modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/DOCS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ sbt-github
22

33
user1/repo
44

5+
name
6+
57
An awesome description
68

79
MIT

modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
@REPO@
44

5+
@DEFAULT_BRANCH@
6+
57
@DESCRIPTION@
68

79
@LICENSE@

modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/github/repository.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"owner": {
66
"url": "{{base_directory}}/user1.json"
77
},
8+
"default_branch": "name",
89
"html_url": "https://github.com/user1/repo",
910
"description": "An awesome description",
1011
"collaborators_url": "{{base_directory}}/collaborators.json",

modules/sbt-github/src/main/scala/com/alejandrohdezma/sbt/github/github/Repository.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ final case class Repository(
4242
license: License,
4343
url: URL,
4444
startYear: Int,
45+
defaultBranch: String,
4546
contributorsUrl: URL,
4647
collaboratorsUrl: URL,
4748
releasesUrl: URL,
@@ -166,6 +167,7 @@ object Repository {
166167
license <- json.get[License]("license")
167168
url <- json.get[URL]("html_url")
168169
startYear <- json.get[ZonedDateTime]("created_at")
170+
defaultBranch <- json.get[String]("default_branch")
169171
contributors <- json.get[URL]("contributors_url")
170172
collaborators <- json.get[URL]("collaborators_url")
171173
organizationUrl <- json.get[Option[URL]]("organization", "url")
@@ -177,6 +179,7 @@ object Repository {
177179
license,
178180
url,
179181
startYear.getYear,
182+
defaultBranch,
180183
contributors,
181184
sbt.url(s"$collaborators".replace("{/collaborator}", "")),
182185
sbt.url(s"$releases".replace("{/id}", "")),

modules/sbt-github/src/main/scala/com/alejandrohdezma/sbt/github/syntax/url.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object url {
2525

2626
/** Adds a query param with the given `key`/`value` pair to this `URL` ad returns it. */
2727
def withQueryParam(key: String, value: String): URL = {
28-
val uri = url.toURI // scalafix:ok Disable.URL
28+
val uri = url.toURI
2929

3030
val query = Option(uri.getQuery)
3131
.map(_ + s"&$key=$value")

modules/sbt-github/src/sbt-test/sbt-github/excluded-contributors/github/repository.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "repo",
33
"full_name": "user1/repo",
44
"created_at": "2018-01-01T13:30:30Z",
5+
"default_branch": "name",
56
"owner": {
67
"url": "{{base_directory}}/user1.json"
78
},

modules/sbt-github/src/sbt-test/sbt-github/extra-collaborators/github/repository.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"owner": {
66
"url": "{{base_directory}}/user1.json"
77
},
8+
"default_branch": "name",
89
"html_url": "https://github.com/user1/repo",
910
"description": "An awesome description",
1011
"collaborators_url": "{{base_directory}}/collaborators.json",

0 commit comments

Comments
 (0)