From db4243edb5771b87caad3ebe396dfdd9c16e9333 Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:10:30 +0000 Subject: [PATCH] feat: add branch name output --- 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 9389bcb..d9e556f 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 e265d04..7913e60 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 f3fb562..161382b 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 55bdfd8..0ec9338 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()