-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from freechipsproject/acknowledgments
Acknowledgments, automatically fetch contributors
- Loading branch information
Showing
6 changed files
with
154 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ test_run_dir | |
*.anno.json | ||
*.v | ||
*.fir | ||
|
||
docs/src/main/tut/contributors.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// See LICENSE for license details. | ||
|
||
import Version.GitHubRepository | ||
|
||
object Contributors { | ||
|
||
import github4s.Github | ||
import github4s.Github._ | ||
import github4s.free.domain.User | ||
import github4s.jvm.Implicits._ | ||
import scalaj.http.HttpResponse | ||
|
||
val token: Option[String] = sys.env.get("GITHUB4S_ACCESS_TOKEN") | ||
|
||
def contributors(repo: GitHubRepository): List[User] = | ||
Github(token) | ||
.repos | ||
.listContributors(repo.owner, repo.repo) | ||
.exec[cats.Id, HttpResponse[String]]() match { | ||
case Left(e) => throw new Exception(s"Unable to fetch contributors for ${repo.serialize}. Did you misspell it?") | ||
case Right(r) => r.result | ||
} | ||
|
||
def contributorsMarkdown(contributors: Seq[User]): String = | ||
contributors | ||
.sortWith((a: User, b: User) => a.login.toLowerCase < b.login.toLowerCase) | ||
.map(a => s"- [`@${a.login}`](${a.html_url})") | ||
.mkString("\n") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters