Created
July 6, 2018 12:19
-
-
Save vijayrawatsan/3d81d6535eaf6f42467a91251c3c2406 to your computer and use it in GitHub Desktop.
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
const token = 'token'; | |
var parse = require('parse-diff'); | |
const octokit = require('@octokit/rest')(); | |
octokit.authenticate({ | |
type: 'oauth', | |
token: token | |
}); | |
async function getFiles(org, repo, prNumber) { | |
let result = {}; | |
let diffPrResponse = await octokit.pullRequests.get({ owner: org, repo: repo, number: prNumber, headers: { accept: 'application/vnd.github.v3.diff' } }); | |
var diff = diffPrResponse.data; | |
var files = parse(diff); | |
return files; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment