Commit 0a9a56f
authored
Skip branch creation on PR saga retry (#1455)
## TL;DR
Prevent duplicate branch creation attempts when the PR saga is retried by checking if the target branch already exists before attempting to create it.
closes #1443
## Problem
When the PR creation saga is retried, it was attempting to create a branch that may have already been created in the previous attempt, causing unnecessary operations and potential failures.
## Changes
- Added a check to compare the current branch against the target branch name before executing branch creation
- Only create the branch if the current branch differs from the target branch name (indicating it hasn't been created yet)
- On retry scenarios, the branch creation step is skipped since we're already on the desired branch
- Refactored `originalBranch` variable to `currentBranch` for clarity since we check it at the start
## How did you test this?
This is a defensive fix for the retry path in PR creation. The logic ensures that if a saga is retried after branch creation has already succeeded, we won't attempt to recreate the branch.1 parent 0e0896f commit 0a9a56f
1 file changed
+19
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 69 | + | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
0 commit comments