Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkg/sync/resync_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,24 @@ func (r resyncRelease) run() error {
}
return runSteps([]step{
r.checkoutAs(downstreamRemote, downstreamBranch, syncBranch),
r.mergeUpstream(upstreamBranch, syncBranch, []step{
r.mergeUpstream(upstreamBranch, []step{
r.checkoutAs(upstreamRemote, upstreamBranch, syncBranch),
changesDetected,
}),
r.checkoutAs(upstreamRemote, upstreamBranch, syncBranch),
r.generateImages(r.rel),
r.commitChanges(r.ImagesGenerated, changesDetected),
func() error {
func() (err error) {
defer func() {
err = errors.Join(err, r.deleteBranch(syncBranch))
}()
if !changes {
return nil
}
return multiStep{
err = multiStep{
r.pushBranch(syncBranch),
r.createSyncReleasePR(downstreamBranch, upstreamBranch, syncBranch),
}.runSteps()
return
},
})
}
Expand All @@ -100,16 +103,13 @@ func (r resyncRelease) checkoutAs(remote git.Remote, targetBranch, branch string
}
}

func (r resyncRelease) mergeUpstream(upstreamBranch, syncBranch string, onChanges []step) step {
func (r resyncRelease) mergeUpstream(upstreamBranch string, onChanges []step) step {
upstream := git.Remote{
Name: "upstream",
URL: r.Upstream,
}
return func() error {
err := r.Merge(&upstream, upstreamBranch)
defer func() {
_ = r.deleteBranch(syncBranch)
}()
if errors.Is(err, gitv5.NoErrAlreadyUpToDate) {
r.Println("- no changes detected")
return nil
Expand Down
Loading