# AWS::CodeStar Construct Library

> Version 2.278.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**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha): its API may change in any release, without a major version bump.
---

![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> 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](https://semver.org/) 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:

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
});
```

Golang:

```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`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-codestar-alpha.GitHubRepository.html) 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

### Constructs (L2)

- [`GitHubRepository`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-codestar-alpha.GitHubRepository.html) Construct (L2) The GitHubRepository resource.

### Structs

- [`GitHubRepositoryProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-codestar-alpha.GitHubRepositoryProps.html) Struct Construction properties of `GitHubRepository`.

### Interfaces

- [`IGitHubRepository`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-codestar-alpha.IGitHubRepository.html) Interface GitHubRepository resource interface.

### Enums

- [`RepositoryVisibility`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-codestar-alpha.RepositoryVisibility.html) Enum Visibility of the GitHubRepository.
