GitHubSourceOptions

class aws_cdk.pipelines.GitHubSourceOptions(*, action_name=None, authentication=None, trigger=None)

Bases: object

Options for GitHub sources.

Parameters:
  • action_name (Optional[str]) – The action name used for this source in the CodePipeline. Default: - The repository string

  • authentication (Optional[SecretValue]) – 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) Default: - SecretValue.secretsManager(‘github-token’)

  • trigger (Optional[GitHubTrigger]) – 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). Default: GitHubTrigger.WEBHOOK

ExampleMetadata:

infused

Example:

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

Attributes

action_name

The action name used for this source in the CodePipeline.

Default:
  • The repository string

authentication

A GitHub OAuth token to use for authentication.

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

oauth = cdk.SecretValue.secrets_manager("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)

Default:
  • SecretValue.secretsManager(‘github-token’)

See:

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

trigger

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).

Default:

GitHubTrigger.WEBHOOK