Skip to content

Commit 8c50816

Browse files
committed
1 parent 20ea4cd commit 8c50816

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lib/router.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const yaml = require('js-yaml')
55
const schema = require('./schema').schema
66

77
const GITHUB_CREDENTIALS = (process.env.CLIENT_ID && process.env.CLIENT_SECRET)
8-
? `client_id=${process.env.CLIENT_ID}&client_secret=${process.env.CLIENT_SECRET}`
8+
? `${process.env.CLIENT_ID}:${process.env.CLIENT_SECRET}@`
99
: ''
1010
const getJSON = uri => requestPromise({
1111
uri,
@@ -135,14 +135,14 @@ module.exports = app => {
135135
routes.get('/check/:owner/:repo', (req, res) => {
136136
const fullName = `${req.params.owner}/${req.params.repo}`
137137
app.log.info(`[${fullName}] Checking ${app.CONFIG_FILENAME}`)
138-
getJSON(`https://api.github.com/repos/${fullName}/contents/.github/${app.CONFIG_FILENAME}?${GITHUB_CREDENTIALS}`)
138+
getJSON(`https://${GITHUB_CREDENTIALS}api.github.com/repos/${fullName}/contents/.github/${app.CONFIG_FILENAME}`)
139139
.then(json => Buffer.from(json.content, 'base64').toString())
140140
.then(yml => yaml.safeLoad(yml))
141141
.then((config) => {
142142
const { error, value } = schema.validate(config)
143143
if (error) throw error
144144
const reqs = value.rules.map(r => new Promise((resolve, reject) => {
145-
getJSON(`https://api.github.com/repos/${fullName}/compare/${r.base}...${r.upstream}?${GITHUB_CREDENTIALS}`)
145+
getJSON(`https://${GITHUB_CREDENTIALS}api.github.com/repos/${fullName}/compare/${r.base}...${r.upstream}`)
146146
.then(githubRes => resolve())
147147
.catch(e => reject(e))
148148
}))

0 commit comments

Comments
 (0)