Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
use octokit/rest instead of got
Browse files Browse the repository at this point in the history
  • Loading branch information
antiwinter committed Sep 12, 2019
1 parent 67ffcf4 commit cddbcdc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions source/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const Octokit = require('@octokit/rest')
const ok = new Octokit({
// auth: process.env.GITHUB_TOKEN
})
const g = require('got')
const log = console.log

let api = {
Expand Down Expand Up @@ -32,7 +31,7 @@ let api = {
? ok.repos.getBranch({ owner, repo, branch: ad.branch })
: ok.repos.listTags({ owner, repo })
h.then(({ data }) => {
// log('got dat', data)
// log('got dat', JSON.stringify(data, null, 2))
let d = {
name: repo,
owner,
Expand Down Expand Up @@ -63,13 +62,18 @@ let api = {
}

let c = ad.branch ? data.commit : data[0].commit
g(c.url).then(res => {
res = JSON.parse(res.body)
// log('inner', res)
d.update = new Date(res.commit.committer.date).valueOf() / 1000

done(d)
})
ok.git
.getCommit({
owner,
repo,
commit_sha: c.sha
})
.then(({ data }) => {
// log('inner', data)
d.update = new Date(data.committer.date).valueOf() / 1000
done(d)
})
}).catch(err => {
done()
})
Expand Down

0 comments on commit cddbcdc

Please sign in to comment.