Skip to content

Commit

Permalink
add label to drfited issue (#1703)
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes authored Sep 12, 2024
1 parent 9552f41 commit 1f192d5
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/pkg/bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (svc BitbucketAPI) ListIssues() ([]*ci.Issue, error) {
return nil, fmt.Errorf("implement me")
}

func (svc BitbucketAPI) PublishIssue(title string, body string) (int64, error) {
func (svc BitbucketAPI) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, fmt.Errorf("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion cli/pkg/digger/digger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (m *MockPRManager) ListIssues() ([]*ci.Issue, error) {
return nil, nil
}

func (m *MockPRManager) PublishIssue(title string, body string) (int64, error) {
func (m *MockPRManager) PublishIssue(title string, body string, labels *[]string) (int64, error) {
m.Commands = append(m.Commands, RunInfo{"PublishComment", body, time.Now()})
return 0, nil
}
Expand Down
3 changes: 2 additions & 1 deletion ee/cli/pkg/drift/github_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ func (ghi GithubIssueNotification) Send(projectName string, plan string) error {
}
return err
} else {
_, err := (*ghi.GithubService).PublishIssue(title, message)
labels := []string{"digger"}
_, err := (*ghi.GithubService).PublishIssue(title, message, &labels)
if err != nil {
log.Printf("error while publishing issue: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ci/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (svc *AzureReposService) ListIssues() ([]*ci.Issue, error) {
return nil, fmt.Errorf("implement me")
}

func (svc *AzureReposService) PublishIssue(title string, body string) (int64, error) {
func (svc *AzureReposService) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, fmt.Errorf("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type PullRequestService interface {
GetChangedFiles(prNumber int) ([]string, error)
PublishComment(prNumber int, comment string) (*Comment, error)
ListIssues() ([]*Issue, error)
PublishIssue(title string, body string) (int64, error)
PublishIssue(title string, body string, labels *[]string) (int64, error)
UpdateIssue(ID int64, title string, body string) (int64, error)
EditComment(prNumber int, id string, comment string) error
CreateCommentReaction(id string, reaction string) error
Expand Down
4 changes: 2 additions & 2 deletions libs/ci/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ func (svc GithubService) ListIssues() ([]*ci.Issue, error) {
return allIssues, nil
}

func (svc GithubService) PublishIssue(title string, body string) (int64, error) {
githubissue, _, err := svc.Client.Issues.Create(context.Background(), svc.Owner, svc.RepoName, &github.IssueRequest{Title: &title, Body: &body})
func (svc GithubService) PublishIssue(title string, body string, labels *[]string) (int64, error) {
githubissue, _, err := svc.Client.Issues.Create(context.Background(), svc.Owner, svc.RepoName, &github.IssueRequest{Title: &title, Body: &body, Labels: labels})
if err != nil {
return 0, fmt.Errorf("could not publish issue: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ci/github/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (t MockCiService) ListIssues() ([]*ci.Issue, error) {
return nil, fmt.Errorf("implement me")
}

func (t MockCiService) PublishIssue(title string, body string) (int64, error) {
func (t MockCiService) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, fmt.Errorf("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ci/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (svc GitLabService) ListIssues() ([]*ci.Issue, error) {
return nil, fmt.Errorf("implement me")
}

func (svc GitLabService) PublishIssue(title string, body string) (int64, error) {
func (svc GitLabService) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, fmt.Errorf("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ci/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (t MockPullRequestManager) ListIssues() ([]*Issue, error) {
return nil, nil
}

func (t MockPullRequestManager) PublishIssue(title string, body string) (int64, error) {
func (t MockPullRequestManager) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, nil
}

Expand Down
2 changes: 1 addition & 1 deletion libs/comment_utils/reporting/reporting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (t MockCiService) ListIssues() ([]*ci.Issue, error) {
return nil, fmt.Errorf("implement me")
}

func (t MockCiService) PublishIssue(title string, body string) (int64, error) {
func (t MockCiService) PublishIssue(title string, body string, labels *[]string) (int64, error) {
return 0, fmt.Errorf("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion libs/orchestrator/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (mockGithubPullrequestManager *MockGithubPullrequestManager) ListIssues() (
return nil, nil
}

func (mockGithubPullrequestManager *MockGithubPullrequestManager) PublishIssue(title string, body string) (int64, error) {
func (mockGithubPullrequestManager *MockGithubPullrequestManager) PublishIssue(title string, body string, labels *[]string) (int64, error) {
mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "PublishIssue")
return 0, nil
}
Expand Down

0 comments on commit 1f192d5

Please sign in to comment.