How to use the pullRequests function from @octokit/rest
Find comprehensive JavaScript @octokit/rest.pullRequests code examples handpicked from public code repositorys.
7 8 9 10 11 12 13 14 15 16
token: process.env.GITHUB_TOKEN }); const {owner, name: repo, filepath: number} = parse(change); const prData = (await octokit.pullRequests.get({owner, repo, number})).data; const prReviews = (await octokit.pullRequests.getReviews({owner, repo, number})).data; const prPatch = (await octokit.pullRequests.get({owner, repo, number, headers: {accept: 'application/vnd.github.v3.patch'}})).data; const prSlug = branch.replace(/^release-/, ''); const prBranch = `backport-${prSlug}-${number}-${prData.head.ref}`;
7
16
77
+ 9 other calls in file
11 12 13 14 15 16 17
}) module.exports = { pullRequest: octokit.pullRequests.create, release: octokit.repos.createRelease, merge: octokit.pullRequests.merge, }
1
12
137
+ 7 other calls in file
6 7 8 9 10 11 12 13 14 15
const {execSync} = require('child_process'); const pr = process.env['CIRCLE_PULL_REQUEST']; if (pr) { const number = +pr.match(/\/(\d+)\/?$/)[1]; return github.pullRequests.get({ owner: 'mapbox', repo: 'mapbox-gl-native', number }).then(({data}) => {
0
6
3
14 15 16 17 18 19 20 21 22 23
const branchName = getBranchName(); // for some reason the editing endpoint doesn't work with the graphql id (it should) // let's find the non-hashed id const prNumber = await octokit.pullRequests.getAll({ owner, repo, state: 'open' }).then(result => { try { return result.data.filter(pr => pr.head.ref === branchName)[0].number; } catch (error) { throw new Error('could not find pr on github');
0
3
4
GitHub: getamis/pr-review
18 19 20 21 22 23 24 25 26 27
}); const promises = projects.map(async project => { const { owner, repo } = project; const state = 'open'; const result = await octokit.pullRequests.getAll({ owner, repo, state }); const prs = result.data.filter( pr => !pr.title.toLowerCase().includes('wip') );
0
0
10
14 15 16 17 18 19 20 21 22 23
async function go() { let allPrs = [] let page = 1 let response do { response = await octokit.pullRequests.list({ owner: 'clearlydefined', repo: 'curated-data', state: 'all', per_page: 100,
0
0
2
8 9 10 11 12 13 14 15 16 17
}) .then(result => { const firstReviewId = result.data[0].id return octokit.pullRequests.getReview({ owner: 'octokit', repo: 'rest.js', number: 640, id: firstReviewId
0
0
1
GitHub: Projectplace/Rocket.Chat
67 68 69 70 71 72 73 74 75 76
if (pr.data.milestone) { info.milestone = pr.data.milestone.title; } return promiseRetryRateLimit(() => octokit.pullRequests.getCommits({owner, repo, number})) .catch(onError) .then(commits => { info.contributors = _.unique(_.flatten(commits.data.map(i => { if (!i.author || !i.committer) {
0
0
28
+ 3 other calls in file
@octokit/rest.Octokit is the most popular function in @octokit/rest (61 examples)