# GitHubSourceOptions

Options for GitHub sources.

Used as argument in: [CodePipelineSource.gitHub](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipelineSource.html#github)

- Source: [`pipelines/lib/codepipeline/codepipeline-source.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source.ts#L204)
- Type last changed: v2.64.0 · 9 Feb 2023

## Example

TypeScript:

```ts
pipelines.CodePipelineSource.gitHub('org/repo', 'branch', {
  // This is optional
  authentication: cdk.SecretValue.secretsManager('my-token'),
});
```

Python:

```python
pipelines.CodePipelineSource.git_hub("org/repo", "branch",
    # This is optional
    authentication=cdk.SecretValue.secrets_manager("my-token")
)
```

Java:

```java
CodePipelineSource.gitHub("org/repo", "branch", GitHubSourceOptions.builder()
        // This is optional
        .authentication(SecretValue.secretsManager("my-token"))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
CodePipelineSource.GitHub("org/repo", "branch", new GitHubSourceOptions {
    // This is optional
    Authentication = SecretValue.SecretsManager("my-token")
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
pipelines.CodePipelineSource_GitHub(jsii.String("org/repo"), jsii.String("branch"), &GitHubSourceOptions{
	// This is optional
	Authentication: cdk.SecretValue_SecretsManager(jsii.String("my-token")),
})
```

## Properties

- `actionName`: string — The action name used for this source in the CodePipeline.

  **Default:** The repository string

- `authentication`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) — A GitHub OAuth token to use for authentication.

  **Default:** SecretValue.secretsManager('github-token')

  It is recommended to use a Secrets Manager `Secret` to obtain the token:

  ```ts
  const oauth = cdk.SecretValue.secretsManager('my-github-token');
  ```

  The GitHub Personal Access Token should have these scopes:

  * **repo** - to read the repository
  * **admin:repo_hook** - if you plan to use webhooks (true by default)

- `trigger`: [GitHubTrigger](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.GitHubTrigger.html) = GitHubTrigger.WEBHOOK — How AWS CodePipeline should be triggered.

  With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action.
  With "POLL", CodePipeline periodically checks the source for changes.
  With "None", the action is not triggered through changes in the source.

  To use `WEBHOOK`, your GitHub Personal Access Token should have
  **admin:repo_hook** scope (in addition to the regular **repo** scope).
