adds signoff option to sign off commits
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
a81d0faef6
commit
ddd52205b6
|
@ -57,6 +57,7 @@ All inputs are **optional**. If not set, sensible defaults will be used.
|
|||
| `team-reviewers` | A comma or newline separated list of GitHub teams to request a review from. Note that a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) may be required. See [this issue](https://github.com/peter-evans/create-pull-request/issues/155). | |
|
||||
| `milestone` | The number of the milestone to associate this pull request with. | |
|
||||
| `draft` | Create a [draft pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests). | `false` |
|
||||
| `signoff` | Add Signed-off-by to commit message | `false` |
|
||||
|
||||
### Action outputs
|
||||
|
||||
|
|
|
@ -56,6 +56,9 @@ inputs:
|
|||
draft:
|
||||
description: 'Create a draft pull request'
|
||||
default: false
|
||||
signoff:
|
||||
description: 'Add "Signed-off-by" to commit message'
|
||||
default: false
|
||||
outputs:
|
||||
pull-request-number:
|
||||
description: 'The pull request number'
|
||||
|
|
|
@ -77,7 +77,8 @@ export async function createOrUpdateBranch(
|
|||
commitMessage: string,
|
||||
base: string,
|
||||
branch: string,
|
||||
branchRemoteName: string
|
||||
branchRemoteName: string,
|
||||
signoff: boolean
|
||||
): Promise<CreateOrUpdateBranchResult> {
|
||||
// Get the working base. This may or may not be the actual base.
|
||||
const workingBase = await git.symbolicRef('HEAD', ['--short'])
|
||||
|
@ -99,7 +100,11 @@ export async function createOrUpdateBranch(
|
|||
if (await git.isDirty(true)) {
|
||||
core.info('Uncommitted changes found. Adding a commit.')
|
||||
await git.exec(['add', '-A'])
|
||||
await git.commit(['-m', commitMessage])
|
||||
if (signoff == true) {
|
||||
await git.commit(['--signoff', '-m', commitMessage])
|
||||
} else {
|
||||
await git.commit(['-m', commitMessage])
|
||||
}
|
||||
}
|
||||
|
||||
// Perform fetch and reset the working base
|
||||
|
|
|
@ -23,6 +23,7 @@ export interface Inputs {
|
|||
teamReviewers: string[]
|
||||
milestone: number
|
||||
draft: boolean
|
||||
signoff: boolean
|
||||
}
|
||||
|
||||
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||
|
@ -166,7 +167,8 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
|||
inputs.commitMessage,
|
||||
inputs.base,
|
||||
inputs.branch,
|
||||
branchRemoteName
|
||||
branchRemoteName,
|
||||
inputs.signoff
|
||||
)
|
||||
core.endGroup()
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ async function run(): Promise<void> {
|
|||
reviewers: utils.getInputAsArray('reviewers'),
|
||||
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
||||
milestone: Number(core.getInput('milestone')),
|
||||
draft: core.getInput('draft') === 'true'
|
||||
draft: core.getInput('draft') === 'true',
|
||||
signoff: core.getInput('signoff') === 'true'
|
||||
}
|
||||
core.debug(`Inputs: ${inspect(inputs)}`)
|
||||
|
||||
|
|
Loading…
Reference in a new issue