I had previously placed a GetIssue call inside of the JIRA client create/update issue functions, but in cases where these functions aren't called (for example, if it skips over the update call because the issue didn't change), the Get call is never made, and an incomplete Issue object (including a nil comments field) is passed to CompareIssues(), causing it to create new comments on every run.
This moves the GetIssue call to the end of the lib.CreateIssue() and lib.UpdateIssue() functions, before the call to CompareIssues(), thus ensuring it is always called.
I had previously placed a GetIssue call inside of the JIRA client create/update issue functions, but in cases where these functions aren't called (for example, if it skips over the update call because the issue didn't change), the Get call is never made, and an incomplete Issue object (including a nil
comments
field) is passed to CompareIssues(), causing it to create new comments on every run.This moves the GetIssue call to the end of the lib.CreateIssue() and lib.UpdateIssue() functions, before the call to CompareIssues(), thus ensuring it is always called.