Skip to content

Commit

Permalink
Log commit author and skip assign issues not created (#63)
Browse files Browse the repository at this point in the history
* Log author retrieved for a commit

* Do not assign issue if it wasn't created

* Change condition to check if issue created

* Change comment to logline

---------

Co-authored-by: Taras <505555+ribtoks@users.noreply.github.com>
  • Loading branch information
sidsprasad and ribtoks authored Jan 23, 2024
1 parent d6dc77e commit ec63fe8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ func (s *service) openNewIssues(issueMap map[string]*github.Issue, comments []*t
func (s *service) assignNewIssues() {
log.Printf("Adding assignees to %v newly created issues...", len(s.issueTitleToAssigneeMap))
for title, assignee := range s.issueTitleToAssigneeMap {
issue := s.newIssuesMap[title]
issue, ok := s.newIssuesMap[title]
if !ok {
log.Printf("Skipping assigning an issue that was not created. title=%v", title)
continue
}
issueNumber := issue.GetNumber()
req := &github.IssueRequest{
Assignees: &[]string{assignee},
Expand All @@ -361,6 +365,7 @@ func (s *service) retrieveCommitAuthor(commitHash string, title string) {
} else if commit != nil && commit.Author != nil && len(*commit.Author.Login) > 0 {
s.issueTitleToAssigneeMap[title] = *commit.Author.Login
s.commitToAuthorCache[commitHash] = *commit.Author.Login
log.Printf("Successfully got author '%v' for commit '%v'\nfor issue title '%v'.", *commit.Author.Login, commitHash, title)
} else {
log.Printf("Error: No author mentioned in commit '%v'", commitHash)
}
Expand Down

0 comments on commit ec63fe8

Please sign in to comment.