forked from airbnb/lottie-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_pr_comment.js
executable file
·35 lines (29 loc) · 1.01 KB
/
post_pr_comment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env node
if (!process.env.TRAVIS_REPO_SLUG) {
process.exit(0);
}
const https = require('https');
const postData = `{\"body\": \"**Snapshot Tests**\\nReport: https://happo.io/a/27/report/${process.env.GIT_SHA}-android26\\nDiff: https://happo.io/a/27/compare/master-android26/${process.env.GIT_SHA}-android26\"}`
const options = {
hostname: 'api.github.com',
path: `/repos/${process.env.TRAVIS_REPO_SLUG}/issues/${process.env.TRAVIS_PULL_REQUEST}/comments`,
port: 443,
method: 'POST',
headers: {
Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN}`,
'Content-Length': postData.length,
'User-Agent': 'Travis/1.6.8 (Mac OS X 10.9.2 like Darwin; Ruby 2.1.1; RubyGems 2.0.14) Faraday/0.8.9 Typhoeus/0.6.7.'
}
};
const req = https.request(options, res => {
console.log('statusCode:', res.statusCode);
console.log('headers:', res.headers);
res.on('data', d => {
process.stdout.write(d);
});
res.on('error', e => {
process.stderr.write(e);
})
})
req.write(postData);
req.end();