This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 26bea3547 fix: Prevent implicit GraphQL disable when pacthing Github
Connection (#8353)
26bea3547 is described below
commit 26bea35473ef38a5287111a75f0bbfbba4fab349
Author: Klesh Wong <[email protected]>
AuthorDate: Mon Mar 24 16:30:52 2025 +0800
fix: Prevent implicit GraphQL disable when pacthing Github Connection
(#8353)
---
backend/plugins/github/models/connection.go | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/backend/plugins/github/models/connection.go
b/backend/plugins/github/models/connection.go
index 23ee6f170..6a8c06a37 100644
--- a/backend/plugins/github/models/connection.go
+++ b/backend/plugins/github/models/connection.go
@@ -20,12 +20,13 @@ package models
import (
"encoding/json"
"fmt"
- "github.com/apache/incubator-devlake/core/utils"
"io"
"net/http"
"strings"
"time"
+ "github.com/apache/incubator-devlake/core/utils"
+
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
@@ -121,16 +122,18 @@ func (connection *GithubConnection)
MergeFromRequest(target *GithubConnection, b
if err := helper.DecodeMapStruct(body, &modifiedConnection, true); err
!= nil {
return err
}
- return connection.Merge(target, &modifiedConnection)
+ return connection.Merge(target, &modifiedConnection, body)
}
-func (connection *GithubConnection) Merge(existed, modified *GithubConnection)
error {
+func (connection *GithubConnection) Merge(existed, modified *GithubConnection,
body map[string]interface{}) error {
// There are many kinds of update, we just update all fields simply.
existedTokenStr := existed.Token
existSecretKey := existed.SecretKey
existed.Name = modified.Name
- existed.EnableGraphql = modified.EnableGraphql
+ if _, ok := body["enableGraphql"]; ok {
+ existed.EnableGraphql = modified.EnableGraphql
+ }
existed.AppId = modified.AppId
existed.SecretKey = modified.SecretKey
existed.InstallationID = modified.InstallationID