Skip to content

Commit b8cfa37

Browse files
Amanda TillyAmanda Tilly
authored andcommitted
fetched and filtered pull requests
1 parent 7412d72 commit b8cfa37

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

code/script.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
const USER = "amandatilly";
22
const REPOS_URL = `https://api.github.com/users/${USER}/repos`;
3-
const PR_URL = `https://api.github.com/repos/Technigo/${reponame}/pulls`;
3+
const NEWSSITE_URL =
4+
"https://api.github.com/repos/Technigo/project-news-site/pulls/222/commits";
5+
46
const projectContainer = document.getElementById("projects");
57

68
const getRepos = () => {
79
fetch(REPOS_URL)
810
.then((res) => res.json())
911
.then((data) => {
1012
console.log(data);
11-
// data.forEach((repo) => console.log(repo.name));
13+
1214
const forkedRepos = data.filter(
1315
(repo) => repo.fork && repo.name.startsWith("project-")
1416
);
1517
forkedRepos.forEach(
1618
(repo) => (projectContainer.innerHTML += `<h3>${repo.name}</h3>`)
1719
);
20+
getPullRequests(forkedRepos);
1821
});
1922
};
2023

2124
const getPullRequests = (repos) => {
2225
repos.forEach((repo) => {
23-
fetch(PR_URL)
26+
fetch(
27+
`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`
28+
)
2429
.then((res) => res.json())
25-
.then((data) => {});
30+
.then((data) => {
31+
// console.log(data);
32+
const userPullRequests = data.filter(
33+
(pull) => pull.user.login === repo.owner.login
34+
);
35+
console.log(userPullRequests);
36+
});
2637
});
2738
};
2839

0 commit comments

Comments
 (0)