Skip to content

Instantly share code, notes, and snippets.

@nisshiee
Created June 14, 2016 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nisshiee/0a1d960b31445c731c20f18c24568953 to your computer and use it in GitHub Desktop.
Save nisshiee/0a1d960b31445c731c20f18c24568953 to your computer and use it in GitHub Desktop.
AWS LambdaからCircleCI Buildをキックするスニペット
var https = require('https')
exports.handler = function(event, context) {
var options = {
hostname: 'circleci.com',
path: '/api/v1/project/${user|org}/${project}/tree/master?circle-token=${token}',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
var body = JSON.stringify({});
var req = https.request(options, function(res) {
console.log('STATUS: %d', res.statusCode);
console.log('HEADERS: %s', JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function(chunk) {
console.log('BODY: %s', chunk);
});
res.on('end', function() {
console.log('No more data in response.');
});
});
req.on('error', function(e) {
console.log('problem with request: %s', e.message);
});
req.write(body);
req.end();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment