Skip to content

Commit 5b8bdf4

Browse files
mtodorporridge
andauthored
Avoid linking the same issues (#32)
Co-authored-by: Marcin Owsiany <porridge@redhat.com>
1 parent 696df52 commit 5b8bdf4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ func (j junit2jira) linkIssues(issues []*jira.Issue) error {
256256
var result error
257257
for x, issue := range issues {
258258
for y := 0; y < x; y++ {
259+
// Skip cases where we have the same inward and outward issue.
260+
// Jira does not allow linking a ticket to itself.
261+
if issue.Key == issues[y].Key {
262+
continue
263+
}
264+
259265
_, err := j.jiraClient.Issue.AddLink(&jira.IssueLink{
260266
Type: jira.IssueLinkType{Name: linkType},
261267
OutwardIssue: &jira.Issue{Key: issue.Key},

0 commit comments

Comments
 (0)