Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
feat: add issue related funcs, and dummy testing func
Browse files Browse the repository at this point in the history
  • Loading branch information
YCK1130 committed Jul 1, 2024
1 parent b953cb7 commit d1aa87e
Show file tree
Hide file tree
Showing 8 changed files with 600 additions and 8 deletions.
10 changes: 9 additions & 1 deletion operator/github/v0/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type GitHubClient struct {
*github.Client
Repositories RepositoriesService
PullRequests PullRequestService
Issues IssuesService
}

func newClient(ctx context.Context, setup *structpb.Struct) Client {
Expand All @@ -33,7 +34,14 @@ func newClient(ctx context.Context, setup *structpb.Struct) Client {
oauth2Client = oauth2.NewClient(ctx, tokenSource)
}
client := github.NewClient(oauth2Client)
githubClient := Client{client: GitHubClient{Client: client, Repositories: client.Repositories, PullRequests: client.PullRequests} }
githubClient := Client{
client: GitHubClient{
Client: client,
Repositories: client.Repositories,
PullRequests: client.PullRequests,
Issues: client.Issues,
},
}
return githubClient
}

Expand Down
4 changes: 0 additions & 4 deletions operator/github/v0/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package github

import (
"context"
"fmt"

"github.com/google/go-github/v62/github"
"github.com/instill-ai/component/base"
Expand Down Expand Up @@ -98,9 +97,6 @@ func (githubClient *Client) getCommitTask(props *structpb.Struct) (*structpb.St
}
var resp GetCommitResp
resp.Commit = githubClient.extractCommitInformation(commit)
fmt.Println("=====================================")
fmt.Println("commit: ",resp.Commit)
fmt.Println("=====================================")
out, err := base.ConvertToStructpb(resp)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions operator/github/v0/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
var MockGithubClient = GitHubClient{
Repositories: &MockRepositoriesService{},
PullRequests: &MockPullRequestService{},
Issues: &MockIssuesService{},
}

var fakeHost = "https://fake-github.com"
Expand Down
5 changes: 4 additions & 1 deletion operator/github/v0/config/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"TASK_GET_PULL_REQUEST",
"TASK_GET_COMMIT",
"TASK_GET_REVIEW_COMMENTS",
"TASK_CREATE_REVIEW_COMMENT"
"TASK_CREATE_REVIEW_COMMENT",
"TASK_GET_ALL_ISSUES",
"TASK_GET_ISSUE",
"TASK_CREATE_ISSUE"
],
"custom": false,
"documentationUrl": "https://www.instill.tech/docs/component/application/github",
Expand Down
Loading

0 comments on commit d1aa87e

Please sign in to comment.