mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
allow empty author/committer
This commit is contained in:
parent
cd5c7e4b8b
commit
5875c1e2e0
4 changed files with 34 additions and 20 deletions
|
@ -74,6 +74,9 @@ inputs:
|
||||||
draft:
|
draft:
|
||||||
description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface'
|
description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface'
|
||||||
default: false
|
default: false
|
||||||
|
author-as-actions:
|
||||||
|
description: 'use GitHub Actions App as the author/committer which signs the commit'
|
||||||
|
default: false
|
||||||
outputs:
|
outputs:
|
||||||
pull-request-number:
|
pull-request-number:
|
||||||
description: 'The pull request number'
|
description: 'The pull request number'
|
||||||
|
|
|
@ -124,7 +124,8 @@ export async function createOrUpdateBranch(
|
||||||
branch: string,
|
branch: string,
|
||||||
branchRemoteName: string,
|
branchRemoteName: string,
|
||||||
signoff: boolean,
|
signoff: boolean,
|
||||||
addPaths: string[]
|
addPaths: string[],
|
||||||
|
useRestApi: boolean
|
||||||
): Promise<CreateOrUpdateBranchResult> {
|
): Promise<CreateOrUpdateBranchResult> {
|
||||||
// Get the working base.
|
// Get the working base.
|
||||||
// When a ref, it may or may not be the actual base.
|
// When a ref, it may or may not be the actual base.
|
||||||
|
|
|
@ -32,6 +32,7 @@ export interface Inputs {
|
||||||
teamReviewers: string[]
|
teamReviewers: string[]
|
||||||
milestone: number
|
milestone: number
|
||||||
draft: boolean
|
draft: boolean
|
||||||
|
commitAsActions: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
|
@ -154,8 +155,14 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
|
|
||||||
// Configure the committer and author
|
// Configure the committer and author
|
||||||
core.startGroup('Configuring the committer and author')
|
core.startGroup('Configuring the committer and author')
|
||||||
|
if (inputs.commitAsActions == true) {
|
||||||
|
const parsedAuthor = ""
|
||||||
|
const parsedCommitter = ""
|
||||||
|
}
|
||||||
|
else {
|
||||||
const parsedAuthor = utils.parseDisplayNameEmail(inputs.author)
|
const parsedAuthor = utils.parseDisplayNameEmail(inputs.author)
|
||||||
const parsedCommitter = utils.parseDisplayNameEmail(inputs.committer)
|
const parsedCommitter = utils.parseDisplayNameEmail(inputs.committer)
|
||||||
|
|
||||||
git.setIdentityGitOptions([
|
git.setIdentityGitOptions([
|
||||||
'-c',
|
'-c',
|
||||||
`author.name=${parsedAuthor.name}`,
|
`author.name=${parsedAuthor.name}`,
|
||||||
|
@ -172,6 +179,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
core.info(
|
core.info(
|
||||||
`Configured git author as '${parsedAuthor.name} <${parsedAuthor.email}>'`
|
`Configured git author as '${parsedAuthor.name} <${parsedAuthor.email}>'`
|
||||||
)
|
)
|
||||||
|
}
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Create or update the pull request branch
|
// Create or update the pull request branch
|
||||||
|
@ -183,7 +191,8 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
inputs.branch,
|
inputs.branch,
|
||||||
branchRemoteName,
|
branchRemoteName,
|
||||||
inputs.signoff,
|
inputs.signoff,
|
||||||
inputs.addPaths
|
inputs.addPaths,
|
||||||
|
inputs.commitAsActions
|
||||||
)
|
)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ async function run(): Promise<void> {
|
||||||
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
||||||
milestone: Number(core.getInput('milestone')),
|
milestone: Number(core.getInput('milestone')),
|
||||||
draft: core.getBooleanInput('draft')
|
draft: core.getBooleanInput('draft')
|
||||||
|
useRestApi: core.getBooleanInput('use-rest-api')
|
||||||
}
|
}
|
||||||
core.debug(`Inputs: ${inspect(inputs)}`)
|
core.debug(`Inputs: ${inspect(inputs)}`)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue