Skip to content
v2.275.0

GitHubSourceProps Struct ​

Construction properties for GitHubSource and GitHubEnterpriseSource.

Example ​

ts
const gitHubSource = codebuild.Source.gitHub({
  owner: 'aws',
  webhookTriggersBatchBuild: true, // optional, default is false
  webhookFilters: [
    codebuild.FilterGroup
      .inEventOf(codebuild.EventAction.WORKFLOW_JOB_QUEUED)
      .andRepositoryNameIs("aws-.*")
      .andRepositoryNameIsNot("aws-cdk-lib"),
  ], // optional, by default all pushes and Pull Requests will trigger a build
});

Properties ​

branchOrRefoptionalstringbranch_or_refoptionalstrbranchOrRefoptionalStringBranchOrRefoptionalstringBranchOrRefoptional*string#
The commit ID, pull request ID, branch name, or tag name that corresponds to the version of the source code you want to build.

Default: the default branch's HEAD commit ID is used

example
ts
'mybranch'
buildStatusContextoptionalstringbuild_status_contextoptionalstrbuildStatusContextoptionalStringBuildStatusContextoptionalstringBuildStatusContextoptional*string#
This parameter is used for the `context` parameter in the GitHub commit status.

Default: "AWS CodeBuild AWSREGION(PROJECT_NAME)"

Can use built-in CodeBuild variables, like $AWS_REGION.

example
ts
"My build #$CODEBUILD_BUILD_NUMBER"
buildStatusUrloptionalstringbuild_status_urloptionalstrbuildStatusUrloptionalStringBuildStatusUrloptionalstringBuildStatusUrloptional*string#
The URL that the build will report back to the source provider.

Default: link to the AWS Console for CodeBuild to a particular build execution

Can use built-in CodeBuild variables, like $AWS_REGION.

example
ts
"$CODEBUILD_PUBLIC_BUILD_URL"
cloneDepthoptionalnumberclone_depthoptionalint | floatcloneDepthoptionalNumberCloneDepthoptionaldoubleCloneDepthoptional*float64#
The depth of history to download.

Minimum value is 0. If this value is 0, greater than 25, or not provided, then the full history is downloaded with each build of the project.

fetchSubmodulesoptionalbooleanfetch_submodulesoptionalboolfetchSubmodulesoptionalBooleanFetchSubmodulesoptionalboolFetchSubmodulesoptional*bool= false#
Whether to fetch submodules while cloning git repo.
identifieroptionalstringidentifieroptionalstridentifieroptionalStringIdentifieroptionalstringIdentifieroptional*string#
The source identifier.

This property is required on secondary sources.

ownerstringownerstrownerStringOwnerstringOwner*stringrequired#
The GitHub Organization/user that owns the repo.
example
ts
'awslabs'
repooptionalstringrepooptionalstrrepooptionalStringRepooptionalstringRepooptional*string#
The name of the repo (without the username).

Default: undefined will create an organization webhook

example
ts
'aws-cdk'
reportBuildStatusoptionalbooleanreport_build_statusoptionalboolreportBuildStatusoptionalBooleanReportBuildStatusoptionalboolReportBuildStatusoptional*bool= true#
Whether to send notifications on your build's start and end.
webhookoptionalbooleanwebhookoptionalboolwebhookoptionalBooleanWebhookoptionalboolWebhookoptional*bool#
Whether to create a webhook that will trigger a build every time an event happens in the repository.

Default: true if any webhookFilters were provided, false otherwise

webhookFiltersoptionalFilterGroup[]webhook_filtersoptionaltyping.List[FilterGroup]webhookFiltersoptionalList<FilterGroup>WebhookFiltersoptionalFilterGroup[]WebhookFiltersoptional*[]FilterGroup#
A list of webhook filters that can constraint what events in the repository will trigger a build.

Default: every push and every Pull Request (create or update) triggers a build

A build is triggered if any of the provided filter groups match. Only valid if webhook was not provided as false.

webhookTriggersBatchBuildoptionalbooleanwebhook_triggers_batch_buildoptionalboolwebhookTriggersBatchBuildoptionalBooleanWebhookTriggersBatchBuildoptionalboolWebhookTriggersBatchBuildoptional*bool= false#
Trigger a batch build from a webhook instead of a standard one.

Enabling this will enable batch builds on the CodeBuild project.