Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add strategy-option parameter #165

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/github-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface Inputs {
reviewers: string[]
teamReviewers: string[]
cherryPickBranch?: string
strategyOption?: string
force?: boolean
}

Expand Down
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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.'
Expand All @@ -24,7 +24,8 @@ export async function run(): Promise<void> {
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}!`)
Expand Down Expand Up @@ -71,7 +72,7 @@ export async function run(): Promise<void> {
'-m',
'1',
'--strategy=recursive',
'--strategy-option=theirs',
`--strategy-option=${inputs.strategyOption ?? 'theirs'}`,
`${githubSha}`
])
if (result.exitCode !== 0 && !result.stderr.includes(CHERRYPICK_EMPTY)) {
Expand Down