Skip to content
v2.274.0

AWS::CodeStar Construct Library ​

Version 2.274.0-alpha.0

Separate package

@aws-cdk/aws-codestar-alpha is not part of aws-cdk-lib — install it separately:

sh
npm install @aws-cdk/aws-codestar-alpha
pip install aws-cdk.aws-codestar-alpha

This module is experimental (alpha): its API may change in any release, without a major version bump.


cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


GitHub Repository ​

To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created:

ts
import * as codestar from '@aws-cdk/aws-codestar-alpha';
import * as s3 from 'aws-cdk-lib/aws-s3'

new codestar.GitHubRepository(this, 'GitHubRepo', {
  owner: 'aws',
  repositoryName: 'aws-cdk',
  accessToken: SecretValue.secretsManager('my-github-token', {
    jsonField: 'token',
  }),
  contentsBucket: s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'),
  contentsKey: 'import.zip',
});
python
import aws_cdk.aws_codestar_alpha as codestar
import aws_cdk.aws_s3 as s3


codestar.GitHubRepository(self, "GitHubRepo",
    owner="aws",
    repository_name="aws-cdk",
    access_token=SecretValue.secrets_manager("my-github-token",
        json_field="token"
    ),
    contents_bucket=s3.Bucket.from_bucket_name(self, "Bucket", "amzn-s3-demo-bucket"),
    contents_key="import.zip"
)
java
import software.amazon.awscdk.services.codestar.alpha.*;
import software.amazon.awscdk.services.s3.*;


GitHubRepository.Builder.create(this, "GitHubRepo")
        .owner("aws")
        .repositoryName("aws-cdk")
        .accessToken(SecretValue.secretsManager("my-github-token", SecretsManagerSecretOptions.builder()
                .jsonField("token")
                .build()))
        .contentsBucket(Bucket.fromBucketName(this, "Bucket", "amzn-s3-demo-bucket"))
        .contentsKey("import.zip")
        .build();
csharp
using Amazon.CDK.AWS.Codestar.Alpha;
using Amazon.CDK.AWS.S3;


new GitHubRepository(this, "GitHubRepo", new GitHubRepositoryProps {
    Owner = "aws",
    RepositoryName = "aws-cdk",
    AccessToken = SecretValue.SecretsManager("my-github-token", new SecretsManagerSecretOptions {
        JsonField = "token"
    }),
    ContentsBucket = Bucket.FromBucketName(this, "Bucket", "amzn-s3-demo-bucket"),
    ContentsKey = "import.zip"
});
go
import codestar "github.com/aws/aws-cdk-go/awscdkcodestaralpha"
import s3 "github.com/aws/aws-cdk-go/awscdk"


codestar.NewGitHubRepository(this, jsii.String("GitHubRepo"), &GitHubRepositoryProps{
	Owner: jsii.String("aws"),
	RepositoryName: jsii.String("aws-cdk"),
	AccessToken: awscdk.SecretValue_SecretsManager(jsii.String("my-github-token"), &SecretsManagerSecretOptions{
		JsonField: jsii.String("token"),
	}),
	ContentsBucket: s3.Bucket_FromBucketName(this, jsii.String("Bucket"), jsii.String("amzn-s3-demo-bucket")),
	ContentsKey: jsii.String("import.zip"),
})

Update or Delete the GitHubRepository ​

At this moment, updates to the GitHubRepository are not supported and the repository will not be deleted upon the deletion of the CloudFormation stack. You will need to update or delete the GitHub repository manually.

Types ​

NameKindSummary
GitHubRepositoryConstruct (L2)The GitHubRepository resource.
GitHubRepositoryPropsStructConstruction properties of GitHubRepository.
IGitHubRepositoryInterfaceGitHubRepository resource interface.
RepositoryVisibilityEnumVisibility of the GitHubRepository.