From c5a7806660adbe173f04e3e038b0ccdcd758773c Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:51:55 -0700 Subject: [PATCH] feat: add branch name output (#2995) --- README.md | 1 + action.yml | 2 ++ dist/index.js | 1 + src/create-pull-request.ts | 1 + 4 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 9389bcbf..d9e556fd 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ The following outputs can be used by subsequent workflow steps. - `pull-request-url` - The URL of the pull request. - `pull-request-operation` - The pull request operation performed by the action, `created`, `updated` or `closed`. - `pull-request-head-sha` - The commit SHA of the pull request branch. +- `pull-request-branch` - The branch name of the pull request. Step outputs can be accessed as in the following example. Note that in order to read the step outputs the action step must have an id. diff --git a/action.yml b/action.yml index e265d048..7913e60f 100644 --- a/action.yml +++ b/action.yml @@ -83,6 +83,8 @@ outputs: description: 'The pull request operation performed by the action, `created`, `updated` or `closed`.' pull-request-head-sha: description: 'The commit SHA of the pull request branch.' + pull-request-branch: + description: 'The pull request branch name' runs: using: 'node20' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index f3fb562b..161382bc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -458,6 +458,7 @@ function createPullRequest(inputs) { core.setOutput('pull-request-operation', 'updated'); } core.setOutput('pull-request-head-sha', result.headSha); + core.setOutput('pull-request-branch', inputs.branch); // Deprecated core.exportVariable('PULL_REQUEST_NUMBER', pull.number); core.endGroup(); diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 55bdfd8a..0ec9338f 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -223,6 +223,7 @@ export async function createPullRequest(inputs: Inputs): Promise { core.setOutput('pull-request-operation', 'updated') } core.setOutput('pull-request-head-sha', result.headSha) + core.setOutput('pull-request-branch', inputs.branch) // Deprecated core.exportVariable('PULL_REQUEST_NUMBER', pull.number) core.endGroup()