-
Notifications
You must be signed in to change notification settings - Fork 1
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
Split some more of github apart, structs for clients, attach methods to structs, stop passing around copies of things by value, etc... #56
Conversation
…nfo on our App asking GH via the install API what it is called, etc...
return c.String(http.StatusBadRequest, err.Error()) | ||
} | ||
|
||
// See if we can move this to a longer lived thing, maybe? It's going to recreate the transport and http Client each time we get a payload |
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.
I have ideas on how we can do this. INSTALL ID may change intermittently, but most other things should stay the same. We can allow someone to update the installID on ghClient, and inside we can say "hey, before you make a request, refresh your token real quick". That's my quick thought on it, so that ghClient can be longer lived?
@@ -142,7 +146,47 @@ func handleProcessWebhook(c echo.Context) (err error) { | |||
case webhook.PullRequestPayload: | |||
switch payload.Action { | |||
case "opened", "reopened", "synchronize": | |||
res, err := ourGithub.HandlePullRequest(c.Logger(), postgresDB, payload, appId, getCurrentCLAVersion()) | |||
// Getting a JWT Apps Transport to ask GitHub about stuff that needs a JWT for asking, such as installInfo | |||
atr, err := ghinstallation.NewAppsTransportKeyFromFile(http.DefaultTransport, int64(appId), filenameTheClaPem) |
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.
I moved the transport setup up a level from github
, because technically we can make these transports longer lived as well.
#60) * found a way to get the App ExternalURL - Thanks @DarthHater! Fixes #59
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
I mostly focused on our
github
package, and did a few things, adding some interfaces, helper methods for obtaining things, and trying to stuff things in the right areas so we are constantly passing around loggers, etc...I THINK this looks cleaner, and it feels cleaner.
Beyond that, I implemented one new API (I think) around checking the GH API (via JWT auth, which is new too) about our apps install, so I can get the botname, etc....