-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for workflow_dispatch event (#51)
* feat: support workflow dispatch trigger * feat: return json instead of text in fetch * feat: add PR_NUMBER to inputs * chore: add logging for troubleshooting * fix: wrong headers on get PR * chore: remove some logs * chore: update logs again * fix: broken url formatting * chore: build fix to url * chore: remove logs and cleanup * docs: add workflow docs to readme file * chore: change back to v1 lockfile * feat: use octokit instead of node-fetch * chore: retur error if no PR number is present * chore: finish unfinished error message * chore: update dist from build * chore: add better conditionals and checks for user input * chore: consolidate getter for PR * fix: add missing await keyword * chore: reduce logic and update pull request function * chroe: update pr number check logic * chore: test output * chore: log more output * chore: remove output logging and change PR number checks * chore: test PR number input * chore: log additional data * chore: use proper condition for check for PR * Update README.md Co-authored-by: Simone Busoli <simone.busoli@gmail.com> * docs: update parameter for pr number Co-authored-by: Simone Busoli <simone.busoli@gmail.com> Co-authored-by: Simone Busoli <simone.busoli@gmail.com>
- Loading branch information
Showing
6 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
const github = require('@actions/github') | ||
|
||
const getPullRequest = async ({ pullRequestNumber, githubToken }) => { | ||
const payload = github.context.payload | ||
const octokit = github.getOctokit(githubToken) | ||
|
||
const repo = payload.repository | ||
const owner = repo.owner.login | ||
const repoName = repo.name | ||
|
||
const { data: pullRequest } = await octokit.rest.pulls.get({ | ||
owner, | ||
repo: repoName, | ||
pull_number: pullRequestNumber, | ||
}) | ||
|
||
return pullRequest | ||
} | ||
|
||
module.exports = getPullRequest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters