Skip to content

Commit a064602

Browse files
sallyomclaude
andcommitted
fix(bugfix): Fix Jira sync not persisting jiraTaskKey to CR
Fixed a variable shadowing bug where jiraTaskKey was not being persisted to the BugFixWorkflow CR after successful Jira sync. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
1 parent 086479b commit a064602

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

components/backend/handlers/bugfix/jira_sync.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ func SyncProjectBugFixWorkflowToJira(c *gin.Context) {
209209
return
210210
}
211211

212-
jiraTaskKey, ok := result["key"].(string)
212+
var ok bool
213+
jiraTaskKey, ok = result["key"].(string)
213214
if !ok {
214215
websocket.BroadcastBugFixJiraSyncFailed(workflowID, workflow.GithubIssueNumber, "No key in Jira response")
215216
c.JSON(http.StatusInternalServerError, gin.H{"error": "Jira response missing key field"})
@@ -306,7 +307,11 @@ func buildJiraDescription(workflow *types.BugFixWorkflow) string {
306307
// Repository and branch information
307308
desc.WriteString("h2. Repository Information\n\n")
308309
desc.WriteString(fmt.Sprintf("* *Repository:* %s\n", workflow.ImplementationRepo.URL))
309-
desc.WriteString(fmt.Sprintf("* *Base Branch:* {{%s}}\n", workflow.ImplementationRepo.Branch))
310+
baseBranch := "main"
311+
if workflow.ImplementationRepo.Branch != nil && *workflow.ImplementationRepo.Branch != "" {
312+
baseBranch = *workflow.ImplementationRepo.Branch
313+
}
314+
desc.WriteString(fmt.Sprintf("* *Base Branch:* {{%s}}\n", baseBranch))
310315
desc.WriteString(fmt.Sprintf("* *Feature Branch:* {{%s}}\n", workflow.BranchName))
311316
desc.WriteString("\n")
312317

@@ -518,4 +523,4 @@ func attachGistsToJira(c *gin.Context, workflow *types.BugFixWorkflow, jiraBase,
518523
}
519524
}
520525
}
521-
}
526+
}

0 commit comments

Comments
 (0)