Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: author in file creation (#5145)

ecmadao4bbfc35eaa8e
diff --git a/backend/plugin/vcs/github/github.go b/backend/plugin/vcs/github/github.go
index 578799e3c3..c396e42f43 100644
--- a/backend/plugin/vcs/github/github.go
+++ b/backend/plugin/vcs/github/github.go
@@ -265,11 +265,11 @@ type Commit struct {
// FileCommit represents a GitHub API request for committing a file.
type FileCommit struct {
- Message string `json:"message"`
- Content string `json:"content"`
- SHA string `json:"sha,omitempty"`
- Branch string `json:"branch,omitempty"`
- Author CommitAuthor `json:"author,omitempty"`
+ Message string `json:"message"`
+ Content string `json:"content"`
+ SHA string `json:"sha,omitempty"`
+ Branch string `json:"branch,omitempty"`
+ Author *CommitAuthor `json:"author,omitempty"`
}
// FetchCommitByID fetches the commit data by its ID from the repository.
@@ -595,7 +595,7 @@ func (p *Provider) CreateFile(ctx context.Context, oauthCtx common.OauthContext,
SHA: fileCommitCreate.SHA,
}
if fileCommitCreate.AuthorName != "" && fileCommitCreate.AuthorEmail != "" {
- fileCommit.Author = CommitAuthor{
+ fileCommit.Author = &CommitAuthor{
Name: fileCommitCreate.AuthorName,
Email: fileCommitCreate.AuthorEmail,
}
diff --git a/backend/plugin/vcs/github/github_test.go b/backend/plugin/vcs/github/github_test.go
index 34455a3b8a..e5ded85a33 100644
--- a/backend/plugin/vcs/github/github_test.go
+++ b/backend/plugin/vcs/github/github_test.go
@@ -371,7 +371,7 @@ func TestProvider_CreateFile(t *testing.T) {
body, err := io.ReadAll(r.Body)
require.NoError(t, err)
- wantBody := `{"message":"my commit message","content":"bXkgbmV3IGZpbGUgY29udGVudHM=","branch":"master","author":{"date":"0001-01-01T00:00:00Z","name":"","email":""}}`
+ wantBody := `{"message":"my commit message","content":"bXkgbmV3IGZpbGUgY29udGVudHM=","branch":"master"}`
assert.Equal(t, wantBody, string(body))
return &http.Response{
StatusCode: http.StatusOK,
@@ -456,7 +456,7 @@ func TestProvider_OverwriteFile(t *testing.T) {
body, err := io.ReadAll(r.Body)
require.NoError(t, err)
- wantBody := `{"message":"update file","content":"bXkgbmV3IGZpbGUgY29udGVudHM=","sha":"7638417db6d59f3c431d3e1f261cc637155684cd","branch":"master","author":{"date":"0001-01-01T00:00:00Z","name":"","email":""}}`
+ wantBody := `{"message":"update file","content":"bXkgbmV3IGZpbGUgY29udGVudHM=","sha":"7638417db6d59f3c431d3e1f261cc637155684cd","branch":"master"}`
assert.Equal(t, wantBody, string(body))
return &http.Response{
StatusCode: http.StatusOK,