Skip to content

Commit c5a7806

Browse files
authored
feat: add branch name output (#2995)
1 parent 4383ba9 commit c5a7806

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ The following outputs can be used by subsequent workflow steps.
117117
- `pull-request-url` - The URL of the pull request.
118118
- `pull-request-operation` - The pull request operation performed by the action, `created`, `updated` or `closed`.
119119
- `pull-request-head-sha` - The commit SHA of the pull request branch.
120+
- `pull-request-branch` - The branch name of the pull request.
120121

121122
Step outputs can be accessed as in the following example.
122123
Note that in order to read the step outputs the action step must have an id.

action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ outputs:
8383
description: 'The pull request operation performed by the action, `created`, `updated` or `closed`.'
8484
pull-request-head-sha:
8585
description: 'The commit SHA of the pull request branch.'
86+
pull-request-branch:
87+
description: 'The pull request branch name'
8688
runs:
8789
using: 'node20'
8890
main: 'dist/index.js'

dist/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ function createPullRequest(inputs) {
458458
core.setOutput('pull-request-operation', 'updated');
459459
}
460460
core.setOutput('pull-request-head-sha', result.headSha);
461+
core.setOutput('pull-request-branch', inputs.branch);
461462
// Deprecated
462463
core.exportVariable('PULL_REQUEST_NUMBER', pull.number);
463464
core.endGroup();

src/create-pull-request.ts

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
223223
core.setOutput('pull-request-operation', 'updated')
224224
}
225225
core.setOutput('pull-request-head-sha', result.headSha)
226+
core.setOutput('pull-request-branch', inputs.branch)
226227
// Deprecated
227228
core.exportVariable('PULL_REQUEST_NUMBER', pull.number)
228229
core.endGroup()

0 commit comments

Comments
 (0)