abeizn commented on code in PR #6572:
URL:
https://github.com/apache/incubator-devlake/pull/6572#discussion_r1418547283
##########
backend/plugins/github/api/init.go:
##########
@@ -50,8 +51,146 @@ func Init(br context.BasicRes, p plugin.PluginMeta) {
},
nil,
nil,
+ customPatch,
+ nil,
+ nil,
)
raProxy =
api.NewDsRemoteApiProxyHelper[models.GithubConnection](dsHelper.ConnApi.ModelApiHelper)
raScopeList =
api.NewDsRemoteApiScopeListHelper[models.GithubConnection, models.GithubRepo,
GithubRemotePagination](raProxy, listGithubRemoteScopes)
raScopeSearch =
api.NewDsRemoteApiScopeSearchHelper[models.GithubConnection,
models.GithubRepo](raProxy, searchGithubRepos)
}
+
+func customPatch(modified, existed *models.GithubConnection) (merged
*models.GithubConnection) {
+ // There are many kinds of update, we just update all fields simply.
+ existedTokenStr := existed.Token
+ existSecretKey := existed.SecretKey
+
+ existed.AppId = modified.AppId
+ existed.SecretKey = modified.SecretKey
+ existed.InstallationID = modified.InstallationID
+ existed.AuthMethod = modified.AuthMethod
+ existed.Proxy = modified.Proxy
+ existed.Endpoint = modified.Endpoint
+ existed.RateLimitPerHour = modified.RateLimitPerHour
+
+ // handle secret
+ if existSecretKey == "" {
+ if modified.SecretKey == "" {
+ // doesn't input secret key, pass
+ } else {
Review Comment:
maybe if modified.SecretKey != "" { xxx } is better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]