Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions GitForWindowsHelper/https-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ const httpsRequest = async (context, hostname, method, requestPath, body, header
path: requestPath,
headers
}
if (process.env.LOG_HTTPS_REQUESTS === 'true') {
const quote = s => !s.match(/[\][.?*\\^_"'`{}()<>@~&+:;$%"; // \t\r\n]/) ? s : `'${s.replace(/'/g, "'\\''")}'`
const commandLine = [
'curl',
options.method === 'GET' ? '' : `-X ${options.method}`,
...Object.entries(options.headers).map(([key, value]) => `-H ${quote(`${key}: ${value}`)}`),
body ? `-d ${quote(body)}` : '',
`https://${options.hostname}${options.path}`,
].filter(e => e).join(' ')
;(context.error || console.error)(commandLine)
}
return new Promise((resolve, reject) => {
try {
const https = require('https')
Expand Down
9 changes: 6 additions & 3 deletions get-webhook-event-payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@
let cursor = Math.floor(answer.oldest.id - rate * (answer.oldest.epoch - until))
for (;;) {
answer = await getAtCursor(cursor)
console.log(`got answer ${JSON.stringify(answer)} for cursor ${cursor}`)
console.error(`got answer ${JSON.stringify(answer)} for cursor ${cursor}`)
if (answer.newest) break
rate /= 2
const newCursor = Math.floor(previousAnswer.oldest.id - rate * (previousAnswer.oldest.epoch - until))
if (newCursor === cursor) break
cursor = newCursor
}
console.log(`got final answer ${JSON.stringify(answer)} for cursor ${cursor}`)
console.error(`got final answer ${JSON.stringify(answer)} for cursor ${cursor}`)
}

while (answer.newest?.epoch && answer.newest.epoch < until) {
Expand Down Expand Up @@ -144,4 +144,7 @@
const fullEvent = await gitHubRequestAsApp(console, 'GET', `/app/hook/deliveries/${e.id}`)
console.log(`id: ${e.id}\naction: ${e.action}\nevent: ${JSON.stringify(fullEvent, null, 2)}`)
}
})().catch(console.log)
})().catch(e => {
console.error(e)
process.exitCode = 1
})