aws-cdk-lib.pipelines.GitHubSourceOptions

interface GitHubSourceOptions

LanguageType name
.NETAmazon.CDK.Pipelines.GitHubSourceOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/pipelines#GitHubSourceOptions
Javasoftware.amazon.awscdk.pipelines.GitHubSourceOptions
Pythonaws_cdk.pipelines.GitHubSourceOptions
TypeScript (source)aws-cdk-lib » pipelines » GitHubSourceOptions

Options for GitHub sources.

Example

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

Properties

NameTypeDescription
actionName?stringThe action name used for this source in the CodePipeline.
authentication?SecretValueA GitHub OAuth token to use for authentication.
trigger?GitHubTriggerHow AWS CodePipeline should be triggered.

actionName?

Type: string (optional, default: The repository string)

The action name used for this source in the CodePipeline.


authentication?

Type: SecretValue (optional, default: SecretValue.secretsManager('github-token'))

A GitHub OAuth token to use for authentication.

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

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)

See also: https://docs.aws.amazon.com/codepipeline/latest/userguide/GitHub-create-personal-token-CLI.html


trigger?

Type: GitHubTrigger (optional, default: 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).