Skip to content

Commit

Permalink
Add repository parameter (#19)
Browse files Browse the repository at this point in the history
* add repo to code

* update dist

* Update index.js

* Revert "update dist"

This reverts commit 63ff1ee.

* Update index.js
  • Loading branch information
TravisEz13 authored Nov 16, 2021
1 parent ed52446 commit 9f36191
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
Expand Down

0 comments on commit 9f36191

Please sign in to comment.