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:11:42 +09:00
parent 6006bcb85e
commit de98022e2c
+10
View File
@@ -702,6 +702,7 @@ export class AppsService {
targetBranch, targetBranch,
`origin/${targetBranch}`, `origin/${targetBranch}`,
], { cwd: workDir }); ], { cwd: workDir });
await this.resetPromotionWorktree(gitBin, workDir);
try { try {
await execFileAsync(gitBin, [ await execFileAsync(gitBin, [
...mergeOptions, ...mergeOptions,
@@ -715,6 +716,7 @@ export class AppsService {
throw error; throw error;
} }
try { try {
await this.resetPromotionWorktree(gitBin, workDir);
await execFileAsync(gitBin, [ await execFileAsync(gitBin, [
...mergeOptions, ...mergeOptions,
'merge', 'merge',
@@ -757,6 +759,7 @@ export class AppsService {
commitSha: string, commitSha: string,
repository: string, repository: string,
) { ) {
await this.resetPromotionWorktree(gitBin, workDir);
await execFileAsync(gitBin, [ await execFileAsync(gitBin, [
...mergeOptions, ...mergeOptions,
'merge', 'merge',
@@ -771,6 +774,13 @@ export class AppsService {
await execFileAsync(gitBin, ['commit', '--allow-empty', '-m', `${repository} release promotion merge`], { cwd: workDir }); await execFileAsync(gitBin, ['commit', '--allow-empty', '-m', `${repository} release promotion merge`], { cwd: workDir });
} }
private async resetPromotionWorktree(gitBin: string, workDir: string) {
await execFileAsync(gitBin, ['merge', '--abort'], { cwd: workDir }).catch(() => undefined);
await execFileAsync(gitBin, ['rebase', '--abort'], { cwd: workDir }).catch(() => undefined);
await execFileAsync(gitBin, ['reset', '--hard'], { cwd: workDir }).catch(() => undefined);
await execFileAsync(gitBin, ['clean', '-fd'], { cwd: workDir }).catch(() => undefined);
}
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')