From 70d2945de4350adb7202bedae19c6b6c90d80120 Mon Sep 17 00:00:00 2001 From: Roman Kishchenko Date: Tue, 15 Sep 2020 18:47:20 +0300 Subject: [PATCH] feat: support cross-repository branch reference (#14) --- action.yml | 4 +++- index.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index b6e6a748..1983d870 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,9 @@ inputs: description: 'GitHub Token' required: true branch: - description: 'Branch name' + description: | + The name of the branch from which the pull request was opened. For cross-repository pull requests namespace the + branch with user or organization name, i.e. 'user:branch-name' or 'org:branch-name'. required: false base: description: 'The base branch name of the Pull Request' diff --git a/index.js b/index.js index 221eccd5..4ae89567 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ const main = async () => { state: 'open' } if (branch) { - query.head = `${context.repo.owner}:${branch}` + query.head = branch.indexOf(':') === -1 ? `${context.repo.owner}:${branch}` : branch } if (base) { query.base = base