-
Notifications
You must be signed in to change notification settings - Fork 503
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
support GitHub Apps #1766
support GitHub Apps #1766
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1766 +/- ##
==========================================
- Coverage 76.52% 74.58% -1.94%
==========================================
Files 118 123 +5
Lines 1989 2042 +53
Branches 56 58 +2
==========================================
+ Hits 1522 1523 +1
- Misses 467 519 +52
Continue to review full report at Codecov.
|
Thanks for the PR @xuwei-k, this looks very interesting! I've one question. The GitHub App is used to get the list of repositories (via installations) as an alternative to the repos file, right? So the usual Scala Steward user (instead of the GH App account) is still used for creating PRs. |
Yes, that's right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, I only have a few minor comments.
} | ||
|
||
/** [[https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps#authenticating-as-a-github-app]] */ | ||
def createJWT(app: GitHubApp, ttl: Duration): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be suspended in F[_]
since it contains side effects (reading the key file and getting the current time).
I guess the ttl
could also be a FiniteDuration
since infinite Duration
s don't make much sense here.
@@ -44,7 +47,8 @@ final class StewardAlg[F[_]](config: Config)(implicit | |||
selfCheckAlg: SelfCheckAlg[F], | |||
streamCompiler: Stream.Compiler[F, F], | |||
workspaceAlg: WorkspaceAlg[F], | |||
F: BracketThrow[F] | |||
F: BracketThrow[F], | |||
githubAppApiAlg: GitHubAppApiAlg[F] | |||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I find it nicer if the F
parameter comes last and everything else is sorted alphabetically.
This looks great! @fthomas are you planning to set up an official Scala Steward app? |
Yes, I will and I'll post the details here when it is running. |
https://github.com/apps/scala-steward is now up and running. Feel free to try it but please don't publicize it. I'm not sure yet if it will completely replace the current |
|
||
/** [[https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#list-repositories-accessible-to-the-app-installation]] | ||
* | ||
* TODO pagination use `page` query param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I disabled the https://github.com/apps/scala-steward app again. For all users of that app: if you want to continue receiving updates by Scala Steward, you can add your repo to https://github.com/scala-steward-org/repos/blob/main/repos-github.md. |
What was the reason for disabling it? |
fix #102
How to use
1. create
GitHub App
https://github.com/settings/apps/new
GitHub App name
set some appropriate name. e.g.scala-steward-app
?Homepage URL
set some appropriate url. e.g.https://github.com/scala-steward-org
?not require
Webhook
use
Metadata
Read-only
permission onlynot require another permissions
select
Any account
2. Generate and save
Private Key
go to
https://github.com/settings/apps/{your application name}
Generate a private key
3. Install
https://github.com/apps/{your application name}/installations/new
select some organizations and/or repositories
4. run
--github-app-id
is--github-app-key-file
is generated private key.{application name}.{date}.private-key.pem