Fix authentication

pull/1786/head
Paul Sauve 8 years ago
parent 5b3fed3e49
commit 8d9374c2aa

@ -8,7 +8,7 @@ sudo: required
env: env:
global: global:
- BUILD_TIMEOUT=10000 - BUILD_TIMEOUT=10000
- BROWSER_USERNAME=PaulBGD - BROWSER_USERNAME=paulsauve1
cache: cache:
directories: directories:
- "$HOME/.yarn-cache" - "$HOME/.yarn-cache"

@ -67,7 +67,7 @@ const headers = {
Authorization: `token ${githubToken}` Authorization: `token ${githubToken}`
}; };
fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/comments`, { headers }) fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/comments`)
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
let addComment = false; let addComment = false;
@ -82,8 +82,9 @@ fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/commen
if (addComment) { if (addComment) {
const contents = '<details><summary>Benchmark Results</summary>' + fs.readFileSync(outputFile) + '</details>'; const contents = '<details><summary>Benchmark Results</summary>' + fs.readFileSync(outputFile) + '</details>';
let action;
if (editId === null) { if (editId === null) {
return fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/comments`, { action = fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/comments`, {
method: 'POST', method: 'POST',
headers, headers,
body: JSON.stringify({ body: JSON.stringify({
@ -91,7 +92,7 @@ fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/commen
}) })
}); });
} else { } else {
return fetch(`https://api.github.com/repos/sveltejs/svelte/issues/comments/${editId}`, { action = fetch(`https://api.github.com/repos/sveltejs/svelte/issues/comments/${editId}`, {
method: 'PATCH', method: 'PATCH',
headers, headers,
body: JSON.stringify({ body: JSON.stringify({
@ -99,5 +100,6 @@ fetch(`https://api.github.com/repos/sveltejs/svelte/issues/${pullRequest}/commen
}) })
}); });
} }
return action.then(res => res.json()).then(res => console.log('[DEBUG]', res));
} }
}); });

Loading…
Cancel
Save