-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sammyteillet/dat 30 aau in the explanation bullet point of (#30)
* feature: use new version of go-github * feature: add comment in report * feature: add comments in process history result
- Loading branch information
Showing
8 changed files
with
54 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package history | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/google/go-github/v42/github" | ||
) | ||
|
||
func GetCommitComments(client *github.Client, ctx context.Context, RepoOwner string, RepoName string, commitSha string) []*github.IssueComment { | ||
pullRequests, _, err := client.PullRequests.ListPullRequestsWithCommit(ctx, RepoOwner, RepoName, commitSha, nil) | ||
if err != nil { | ||
println("[DATADRIFT ERROR] getting pull request:", err.Error()) | ||
return []*github.IssueComment{} | ||
} | ||
if len(pullRequests) == 0 { | ||
println("No pull request found") | ||
return []*github.IssueComment{} | ||
} | ||
comments, _, err := client.Issues.ListComments(ctx, RepoOwner, RepoName, pullRequests[0].GetNumber(), nil) | ||
if err != nil { | ||
println("[DATADRIFT ERROR] getting comments:", err.Error()) | ||
return []*github.IssueComment{} | ||
} | ||
|
||
return comments | ||
} |