Skip to content

Commit cdcbc94

Browse files
Camilla HallbergCamilla Hallberg
authored andcommitted
fetched pullrequests data, yay
1 parent 24b1182 commit cdcbc94

1 file changed

Lines changed: 31 additions & 20 deletions

File tree

code/script.js

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const API_URL = `https://api.github.com/users/${username}/repos`
55
const API_URL_PR = `https://api.github.com/repos/Technigo/${reponame}/pulls`
66

77
const API_TOKEN = TOKEN;
8-
console.log(TOKEN)
8+
// console.log(TOKEN)
99

1010
const options = {
1111
method: 'GET',
@@ -22,24 +22,35 @@ fetch(API_URL, options)
2222
const technigoRepos = data.filter(
2323
(repo) => repo.name.includes('project-') && repo.fork);
2424
console.log(technigoRepos, 'technigo repos')
25+
26+
const getPullRequests = (repos) => {
27+
repos.forEach(repo => {
28+
fetch('https://api.github.com/repos/technigo/' + repo.name + '/pulls?per_page=150', options)
29+
.then(res => res.json())
30+
.then(data2 => {
31+
console.log(data2, 'every pull for each project')
32+
})
33+
})
34+
}
35+
getPullRequests(technigoRepos);
2536
})
2637

27-
//Remember to pass along your filtered repos as an argument when
28-
//you are calling this function
29-
30-
const getPullRequests = (repos) => {
31-
//Get all the PRs for each project.
32-
repos.forEach(repo => {
33-
fetch('https://api.github.com/repos/technigo/' + repo.name + '/pulls')
34-
.then(res => res.json())
35-
.then(data => {
36-
//TODO
37-
//1. Find only the PR that you made by comparing pull.user.login
38-
// with repo.owner.login
39-
//2. Now you're able to get the commits for each repo by using
40-
// the commits_url as an argument to call another function
41-
//3. You can also get the comments for each PR by calling
42-
// another function with the review_comments_url as argument
43-
})
44-
})
45-
}
38+
39+
40+
41+
// const getPullRequests = (repos) => {
42+
// //Get all the PRs for each project.
43+
// repos.forEach(repo => {
44+
// fetch('https://api.github.com/repos/technigo/' + repo.name + '/pulls')
45+
// .then(res => res.json())
46+
// .then(data => {
47+
// //TODO
48+
// //1. Find only the PR that you made by comparing pull.user.login
49+
// // with repo.owner.login
50+
// //2. Now you're able to get the commits for each repo by using
51+
// // the commits_url as an argument to call another function
52+
// //3. You can also get the comments for each PR by calling
53+
// // another function with the review_comments_url as argument
54+
// // })
55+
// })
56+
// }

0 commit comments

Comments
 (0)