Open xgqfrms-GitHub opened 7 years ago
https://developer.github.com/v3/
Accept: application/vnd.github.v3+json
[
{
"sha":"c66c9a9b21b1799cc0d069982a0ff0971ea2d8e3",
"commit":{
"author":{
"name":"anonymous",
"email":"xgqfrms@gmail.com",
"date":"2017-06-11T15:28:34Z"
},
"committer":{
"name":"GitHub",
"email":"noreply@github.com",
"date":"2017-06-11T15:28:34Z"
},
"message":"backup",
"tree":{
"sha":"f9bf73ffcb5911499b989b31a386dac75d24cb96",
"url":"https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/git/trees/f9bf73ffcb5911499b989b31a386dac75d24cb96"
},
"url":"https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/git/commits/c66c9a9b21b1799cc0d069982a0ff0971ea2d8e3",
"comment_count":0
},
"url":"https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/commits/c66c9a9b21b1799cc0d069982a0ff0971ea2d8e3",
"html_url":"https://github.com/xgqfrms-GitHub/Node-CLI-Tools/commit/c66c9a9b21b1799cc0d069982a0ff0971ea2d8e3",
"comments_url":"https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/commits/c66c9a9b21b1799cc0d069982a0ff0971ea2d8e3/comments",
"author":{
"login":"xgqfrms-GitHub",
"id":18028768,
"avatar_url":"https://avatars0.githubusercontent.com/u/18028768?v=3",
"gravatar_id":"",
"url":"https://api.github.com/users/xgqfrms-GitHub",
"html_url":"https://github.com/xgqfrms-GitHub",
"followers_url":"https://api.github.com/users/xgqfrms-GitHub/followers",
"following_url":"https://api.github.com/users/xgqfrms-GitHub/following{/other_user}",
"gists_url":"https://api.github.com/users/xgqfrms-GitHub/gists{/gist_id}",
"starred_url":"https://api.github.com/users/xgqfrms-GitHub/starred{/owner}{/repo}",
"subscriptions_url":"https://api.github.com/users/xgqfrms-GitHub/subscriptions",
"organizations_url":"https://api.github.com/users/xgqfrms-GitHub/orgs",
"repos_url":"https://api.github.com/users/xgqfrms-GitHub/repos",
"events_url":"https://api.github.com/users/xgqfrms-GitHub/events{/privacy}",
"received_events_url":"https://api.github.com/users/xgqfrms-GitHub/received_events",
"type":"User",
"site_admin":false
},
"committer":{
"login":"web-flow",
"id":19864447,
"avatar_url":"https://avatars0.githubusercontent.com/u/19864447?v=3",
"gravatar_id":"",
"url":"https://api.github.com/users/web-flow",
"html_url":"https://github.com/web-flow",
"followers_url":"https://api.github.com/users/web-flow/followers",
"following_url":"https://api.github.com/users/web-flow/following{/other_user}",
"gists_url":"https://api.github.com/users/web-flow/gists{/gist_id}",
"starred_url":"https://api.github.com/users/web-flow/starred{/owner}{/repo}",
"subscriptions_url":"https://api.github.com/users/web-flow/subscriptions",
"organizations_url":"https://api.github.com/users/web-flow/orgs",
"repos_url":"https://api.github.com/users/web-flow/repos",
"events_url":"https://api.github.com/users/web-flow/events{/privacy}",
"received_events_url":"https://api.github.com/users/web-flow/received_events",
"type":"User",
"site_admin":false
},
"parents":[
{
"sha":"02ec87944cbb16270ef307110731f3f63d0d970d",
"url":"https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/commits/02ec87944cbb16270ef307110731f3f63d0d970d",
"html_url":"https://github.com/xgqfrms-GitHub/Node-CLI-Tools/commit/02ec87944cbb16270ef307110731f3f63d0d970d"
}
]
}
]
const colors = require('colors');
const fetch = require('node-fetch');
let username = process.argv[2] ? process.argv[2] : `xgqfrms-GitHub`;
repo = process.argv[3] ? process.argv[3] : `Node-CLI-Tools`;
fetch(`https://api.github.com/repos/${username}/${repo}/commits`,{
data: {
client_id: '08ecc2f68d922f18800e',
client_secret: '5846d428b5340812b76c9637eceaee979340b922'
}
})
.then((response) => response.json())
.then((json)=> {
console.log(`json = ${json}`);
return repos = json;
})
.then((repos)=>{
console.log(`repos = ${repos}`);
console.log(`repos = ${repos.length}`);
for (let i = 0; i < repos.length; i++) {
console.log(`\n\nrepos${i}\n`);
console.log(`${i} sha = ${repos[i].sha}`);
console.log(`${i} url = ${repos[i].url}`);
console.log(`${i} login = ${repos[i].author.login}`);
console.log(`${i} avatar_url = ${repos[i].author.avatar_url}`);
console.log(`${i} commit.message = ${repos[i].commit.message}`);
console.log(`${i} url = ${repos[i].commit.url}`);
console.log(`${i} date = ${repos[i].commit.author.date}`);
console.log(`${i} name = ${repos[i].commit.author.name}`);
}
});
https://developer.github.com/v3/repos/commits/