Created
August 20, 2019 09:11
Revisions
-
dmail created this gist
Aug 20, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // https://developer.github.com/v3/pulls/#list-pull-requests const fetch = require("node-fetch") const listPullRequestForBranch = async ({ token, repoOwner, repoName, head }) => { try { const href = `https://api.github.com/repos/${repoOwner}/${repoName}/pulls?head=${encodeURIComponent( head, )}` const response = await fetch(href, { headers: { authorization: `token ${token}`, }, method: "GET", }) const status = response.status const responseBodyAsJSON = await response.json() if (status !== 200) { console.log({ status, responseBodyAsJSON, }) } return responseBodyAsJSON } catch (e) { throw e } }