Skip to content

Commit 0035b2d

Browse files
committed
added function for fetching API for all my repos and filtering them on forks and projects from Technigo
1 parent ded93a5 commit 0035b2d

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

code/script.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const username = 'Kras053'
2+
const API_URL =`https://api.github.com/users/${username}/repos`
3+
4+
//my repos in GitHub filtered on forks from Technigo
5+
const myRepos = () => {
6+
7+
fetch(API_URL)
8+
.then((response) => response.json())
9+
.then((data) => {
10+
console.log(data)
11+
12+
const forkedRepos = data.filter(repo => repo.fork)
13+
const technigoRepos = data.filter(repo => repo.name.startsWith('project'))
14+
console.log(forkedRepos)
15+
console.log(technigoRepos)
16+
})
17+
}
18+
19+
myRepos()
20+
21+
22+
23+
24+
/* later specific repos list
25+
const getPullRequests = (repos) => {
26+
repos.forEach(repo => {
27+
fetch('API_URL')
28+
.then(res => res.json())
29+
.then(data => {
30+
console.log(data)
31+
})
32+
33+
})
34+
35+
}*/
36+
37+
/*
38+
39+
https://api.github.com/repos/Technigo/${reponame}/pulls
40+
41+
*/
42+
43+
/*
44+
step 1 worked:
45+
const username = 'Kras053'
46+
const API_URL =`https://api.github.com/users/${username}/repos`
47+
48+
fetch(API_URL)
49+
.then((response) => response.json())
50+
.then((data) => {
51+
console.log('data', data)
52+
})
53+
*/

0 commit comments

Comments
 (0)