mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
feat: add output for head sha
This commit is contained in:
parent
3c3d696d5b
commit
c0a9598b0e
4 changed files with 372 additions and 1133 deletions
|
@ -110,7 +110,8 @@ export async function createOrUpdateBranch(
|
|||
const result: CreateOrUpdateBranchResult = {
|
||||
action: 'none',
|
||||
base: base,
|
||||
hasDiffWithBase: false
|
||||
hasDiffWithBase: false,
|
||||
headSha: ''
|
||||
}
|
||||
|
||||
// Save the working base changes to a temporary branch
|
||||
|
@ -231,6 +232,9 @@ export async function createOrUpdateBranch(
|
|||
result.hasDiffWithBase = await isAhead(git, base, branch)
|
||||
}
|
||||
|
||||
// Get the pull request branch SHA
|
||||
result.headSha = await git.revParse('HEAD')
|
||||
|
||||
// Delete the temporary branch
|
||||
await git.exec(['branch', '--delete', '--force', tempBranch])
|
||||
|
||||
|
@ -241,4 +245,5 @@ interface CreateOrUpdateBranchResult {
|
|||
action: string
|
||||
base: string
|
||||
hasDiffWithBase: boolean
|
||||
headSha: string
|
||||
}
|
||||
|
|
|
@ -212,6 +212,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
|||
} else if (result.action == 'updated') {
|
||||
core.setOutput('pull-request-operation', 'updated')
|
||||
}
|
||||
core.setOutput('pull-request-head-sha', result.headSha)
|
||||
// Deprecated
|
||||
core.exportVariable('PULL_REQUEST_NUMBER', pull.number)
|
||||
core.endGroup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue