resolve release promotion unrelated-history conflicts by taking source side
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-07 18:09:14 +09:00
parent aef91b51bb
commit 6006bcb85e
+22 -10
View File
@@ -724,16 +724,7 @@ export class AppsService {
commitSha, commitSha,
], { cwd: workDir }); ], { cwd: workDir });
} catch { } catch {
await execFileAsync(gitBin, [ await this.resolveReleaseMergeByTakingSourceOnConflict(gitBin, workDir, mergeOptions, commitSha, repository);
...mergeOptions,
'merge',
'--allow-unrelated-histories',
'--no-ff',
'--no-edit',
'-X',
'theirs',
commitSha,
], { cwd: workDir });
} }
} }
} else { } else {
@@ -759,6 +750,27 @@ export class AppsService {
} }
} }
private async resolveReleaseMergeByTakingSourceOnConflict(
gitBin: string,
workDir: string,
mergeOptions: string[],
commitSha: string,
repository: string,
) {
await execFileAsync(gitBin, [
...mergeOptions,
'merge',
'--allow-unrelated-histories',
'--no-ff',
'--no-edit',
'--no-commit',
commitSha,
], { cwd: workDir });
await execFileAsync(gitBin, ['checkout', '--theirs', '.'], { cwd: workDir });
await execFileAsync(gitBin, ['add', '-A'], { cwd: workDir });
await execFileAsync(gitBin, ['commit', '--allow-empty', '-m', `${repository} release promotion merge`], { cwd: workDir });
}
private getHttpCloneUrl(repository: string) { private getHttpCloneUrl(repository: string) {
return `${this.configService return `${this.configService
.get<string>('GITEA_BASE_URL', 'http://localhost:3000') .get<string>('GITEA_BASE_URL', 'http://localhost:3000')