From 9f361916a9aaa20bab73bf82f297f7e8a20fdfa7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 16 Nov 2021 12:22:21 -0800 Subject: [PATCH] Add repository parameter (#19) * add repo to code * update dist * Update index.js * Revert "update dist" This reverts commit 63ff1eec40eab5ddc775852771e9910849092acf. * Update index.js --- action.yml | 3 +++ index.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 66b5a0a2..a42c7b94 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,9 @@ inputs: number: description: 'Pull Request number' required: true + repo: + description: 'Pull Request repo in owner/repo format' + required: false runs: using: 'node12' main: 'dist/index.js' diff --git a/index.js b/index.js index 9e8cf09d..0bd06bfc 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,20 @@ const { GitHub, context } = require('@actions/github') const main = async () => { const token = core.getInput('github-token') const number = core.getInput('number') + const repoString = core.getInput('repo') + + let repoObject + if (repoString) { + const [owner, repo] = repoString.split('/') + repoObject = { owner, repo } + } else { + repoObject = context.repo + } const octokit = new GitHub(token) await octokit.pulls.createReview({ - ...context.repo, + ...repoObject, pull_number: number, event: 'APPROVE' })