AWS Codebuild createProject method is missing OAuth token parameter for Github auth?
I would like to avoid using CodePipeline. I would like to programmatically create a code build project with Github token but I can't seem to find a way to include a GitHub token. As anyone experienced this?
var params = {
artifacts: {
/* required */
type: 'S3',
location: 'STRING_VALUE',
packaging: 'ZIP'
},
environment: {
/* required */
computeType: 'BUILD_GENERAL1_LARGE',
image: 'aws/codebuild/nodejs:4.3.2', /* required */
type: "LINUX_CONTAINER",
},
name: key, /* required */
source: {
/* required */
type: "GITHUB",
auth: {
type: "OAUTH"
},
buildspec: 'echo "test";',
location: `https://github.com/${original.organizations.name}/${original.repos.name}.git`,
},
description: 'STRING_VALUE',
serviceRole: 'arn:aws:iam::171566796811:role/tmmmm6',
timeoutInMinutes: 5
};
codebuild.createProject(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
console.log("WEBHOOK")
var params = {
projectName: key /* required */
};
codebuild.createWebhook(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
});
I tried with the following URL format :
https://${original.github.token}:@github.com/${original.organizations.name}/${original.repos.name}.git
but that does not work. Codebuild would not allow me to create a webhook.
Here is the documentation. http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CodeBuild.html Is it possible to create a code build with GitHub access token? I know how to do it with code pipeline but I would like to avoid using code pipeline if possible.