Skip to content

Commit 6c94257

Browse files
fix: check if repo id exists
1 parent b045661 commit 6c94257

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/travis.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ async function setUpTravis (pkg, info) {
8888
log.info('Syncing repositories...')
8989
await syncTravis(travis)
9090

91-
const {repo} = await promisify(travis.repos(info.ghrepo.slug[0], info.ghrepo.slug[1]).get.bind(travis))()
92-
travis.repoid = repo.id
91+
travis.repoid = _.get(await promisify(travis.repos(info.ghrepo.slug[0], info.ghrepo.slug[1]).get.bind(travis))(), 'repo.id')
9392

94-
const {result} = await promisify(travis.hooks(repo.id).put.bind(travis))({
93+
if (!travis.repoid) throw new Error('Could not get repo id')
94+
95+
const {result} = await promisify(travis.hooks(travis.repoid).put.bind(travis))({
9596
hook: {active: true}
9697
})
9798
if (!result) throw new Error('Could not enable hook on Travis CI')

0 commit comments

Comments
 (0)