From 2bf5623725334d2de53dbf7a5bab8655611f2d73 Mon Sep 17 00:00:00 2001 From: Kajetan Szymczak Date: Fri, 25 Oct 2024 00:27:22 +0200 Subject: [PATCH] feat: Add strategy-option parameter --- src/github-helper.ts | 1 + src/index.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/github-helper.ts b/src/github-helper.ts index 4bca9b3..b1880e5 100644 --- a/src/github-helper.ts +++ b/src/github-helper.ts @@ -18,6 +18,7 @@ export interface Inputs { reviewers: string[] teamReviewers: string[] cherryPickBranch?: string + strategyOption?: string force?: boolean } diff --git a/src/index.ts b/src/index.ts index 9523752..24749e5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ import * as core from '@actions/core' -import * as io from '@actions/io' import * as exec from '@actions/exec' -import * as utils from './utils' import * as github from '@actions/github' -import {Inputs, createPullRequest} from './github-helper' -import {PullRequest} from '@octokit/webhooks-types' +import * as io from '@actions/io' +import { PullRequest } from '@octokit/webhooks-types' +import { Inputs, createPullRequest } from './github-helper' +import * as utils from './utils' const CHERRYPICK_EMPTY = 'The previous cherry-pick is now empty, possibly due to conflict resolution.' @@ -24,7 +24,8 @@ export async function run(): Promise { assignees: utils.getInputAsArray('assignees'), reviewers: utils.getInputAsArray('reviewers'), teamReviewers: utils.getInputAsArray('team-reviewers'), - cherryPickBranch: core.getInput('cherry-pick-branch') + cherryPickBranch: core.getInput('cherry-pick-branch'), + strategyOption: core.getInput('strategy-option') } core.info(`Cherry pick into branch ${inputs.branch}!`) @@ -71,7 +72,7 @@ export async function run(): Promise { '-m', '1', '--strategy=recursive', - '--strategy-option=theirs', + `--strategy-option=${inputs.strategyOption ?? 'theirs'}`, `${githubSha}` ]) if (result.exitCode !== 0 && !result.stderr.includes(CHERRYPICK_EMPTY)) {