diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18948c7d..c37050a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: Backport on: push: @@ -7,7 +7,7 @@ on: branches: [ main ] jobs: - build: + ci: runs-on: ubuntu-latest strategy: matrix: diff --git a/src/entrypoint.cli.ts b/src/entrypoint.cli.ts index a91e2b90..4a28d37b 100644 --- a/src/entrypoint.cli.ts +++ b/src/entrypoint.cli.ts @@ -1,4 +1,3 @@ -#!/usr/bin/env node import yargsParser from 'yargs-parser'; import { backportRun } from './backportRun'; import { ConfigFileOptions } from './entrypoint.module'; diff --git a/src/ui/cherrypickAndCreateTargetPullRequest.test.ts b/src/ui/cherrypickAndCreateTargetPullRequest.test.ts index 4f3d85c5..2b0575a3 100644 --- a/src/ui/cherrypickAndCreateTargetPullRequest.test.ts +++ b/src/ui/cherrypickAndCreateTargetPullRequest.test.ts @@ -397,24 +397,18 @@ describe('cherrypickAndCreateTargetPullRequest', () => { }); it('logs correctly', async () => { - expect(consoleLogSpy.mock.calls[0][0]).toMatchInlineSnapshot(` - " - Backporting to 6.x:" - `); - expect(consoleLogSpy.mock.calls[1][0]).toMatchInlineSnapshot(` + expect(consoleLogSpy.mock.calls.map((call) => call[0]).join('')) + .toMatchInlineSnapshot(` " + Backporting to 6.x: The commit could not be backported due to conflicts - " - `); - expect(consoleLogSpy.mock.calls[2][0]).toMatchInlineSnapshot(` - " + Please fix the conflicts in /myHomeDir/.backport/repositories/elastic/kibana ---------------------------------------- - " - `); - expect(consoleLogSpy.mock.calls[3][0]).toMatchInlineSnapshot(` - " + ---------------------------------------- - " + + ---------------------------------------- + View pull request: myHtmlUrl" `); }); }); diff --git a/src/ui/cherrypickAndCreateTargetPullRequest.ts b/src/ui/cherrypickAndCreateTargetPullRequest.ts index 6e3244f5..a96ff06f 100644 --- a/src/ui/cherrypickAndCreateTargetPullRequest.ts +++ b/src/ui/cherrypickAndCreateTargetPullRequest.ts @@ -192,6 +192,8 @@ async function waitForCherrypick( throw e; } + const repoPath = getRepoPath(options); + // resolve conflicts automatically if (options.autoFixConflicts) { const autoResolveSpinner = ora( @@ -199,7 +201,6 @@ async function waitForCherrypick( 'Attempting to resolve conflicts automatically' ).start(); - const repoPath = getRepoPath(options); const didAutoFix = await options.autoFixConflicts({ files: conflictingFiles.map((f) => f.absolute), directory: repoPath, @@ -232,6 +233,7 @@ async function waitForCherrypick( consoleLog( chalk.bold('\nThe commit could not be backported due to conflicts\n') ); + consoleLog(`Please fix the conflicts in ${repoPath}`); if (commitsWithoutBackports.length > 0) { consoleLog( @@ -250,7 +252,6 @@ async function waitForCherrypick( */ if (options.editor) { - const repoPath = getRepoPath(options); await exec(`${options.editor} ${repoPath}`, { cwd: options.cwd }); }