Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(travis): run travis comment command to comment benchmarking res…
…ults
- Loading branch information
1 parent
eae7028
commit d5859f3
Showing
4 changed files
with
883 additions
and
808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Created by tushar.mathur on 13/11/16. | ||
*/ | ||
|
||
const rp = require('request-promise') | ||
|
||
|
||
let body = '' | ||
process.stdin.resume() | ||
process.stdin.setEncoding('utf8') | ||
process.stdin.on('data', (chunk: string) => body += chunk) | ||
process.stdin.on('end', () => main().then( | ||
x => console.log('Success'), | ||
function (err) { | ||
console.error(err.message) | ||
} | ||
)) | ||
|
||
function getParams () { | ||
const [owner, repo] = process.env.TRAVIS_REPO_SLUG.split('/') | ||
return { | ||
owner, repo, | ||
number: process.env.TRAVIS_PULL_REQUEST | ||
} | ||
} | ||
|
||
async function main () { | ||
if (!process.env.TRAVIS_PULL_REQUEST) return | ||
const p = getParams() | ||
const uri = `https://api.github.com/repos/${p.owner}/${p.repo}/issues/${p.number}/comments` | ||
return rp({ | ||
uri, | ||
method: 'POST', | ||
body: {body}, | ||
json: true, | ||
headers: {'User-Agent': p.repo}, | ||
qs: {access_token: process.env.GH_TOKEN} | ||
}) | ||
} |
Oops, something went wrong.