Skip to content

Commit e374ca9

Browse files
committed
Proper checkout of resync branch
1 parent 4e4c5d9 commit e374ca9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/sync/resync_releases.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,20 @@ func (r resyncRelease) run() error {
7878
r.checkoutAs(upstreamRemote, upstreamBranch, syncBranch),
7979
changesDetected,
8080
}),
81-
r.checkoutAs(upstreamRemote, upstreamBranch, syncBranch),
8281
r.generateImages(r.rel),
8382
r.commitChanges(r.ImagesGenerated, changesDetected),
84-
func() error {
83+
func() (err error) {
84+
defer func() {
85+
err = errors.Join(err, r.deleteBranch(syncBranch))
86+
}()
8587
if !changes {
8688
return nil
8789
}
88-
return multiStep{
90+
err = multiStep{
8991
r.pushBranch(syncBranch),
9092
r.createSyncReleasePR(downstreamBranch, upstreamBranch, syncBranch),
9193
}.runSteps()
94+
return
9295
},
9396
})
9497
}
@@ -107,9 +110,6 @@ func (r resyncRelease) mergeUpstream(upstreamBranch, syncBranch string, onChange
107110
}
108111
return func() error {
109112
err := r.Merge(&upstream, upstreamBranch)
110-
defer func() {
111-
_ = r.deleteBranch(syncBranch)
112-
}()
113113
if errors.Is(err, gitv5.NoErrAlreadyUpToDate) {
114114
r.Println("- no changes detected")
115115
return nil

0 commit comments

Comments
 (0)