create_webhook
¶
create_webhook(
project_name: ProjectName,
*,
config_overrides: Optional[CodeBuildClientConfig] = None,
branch_filter: Optional[String] = None,
filter_groups: Optional[FilterGroups] = None,
build_type: Optional[WebhookBuildType] = None,
manual_creation: Optional[WrapperBoolean] = None,
scope_configuration: Optional[ScopeConfiguration] = None,
pull_request_build_policy: Optional[PullRequestBuildPolicy] = None,
) -> CreateWebhookOutput
For an existing CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables CodeBuild to start rebuilding the source code every time a code change is pushed to the repository.
If you enable webhooks for an CodeBuild project, and the project is used as a build step in CodePipeline, then two identical builds are created for each commit. One build is triggered through webhooks, and one through CodePipeline. Because billing is on a per-build basis, you are billed for both builds. Therefore, if you are using CodePipeline, we recommend that you disable webhooks in CodeBuild. In the CodeBuild console, clear the Webhook box. For more information, see step 5 in Change a Build Project's Settings.
Parameters:
-
project_name(ProjectName) –The name of the CodeBuild project.
-
branch_filter(Optional[String], default:None) –A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If
branchFilteris empty, then all branches are built.It is recommended that you use
filterGroupsinstead ofbranchFilter. -
filter_groups(Optional[FilterGroups], default:None) –An array of arrays of
WebhookFilterobjects used to determine which webhooks are triggered. At least oneWebhookFilterin the array must specifyEVENTas itstype.For a build to be triggered, at least one filter group in the
filterGroupsarray must pass. For a filter group to pass, each of its filters must pass. -
build_type(Optional[WebhookBuildType], default:None) –Specifies the type of build this webhook will trigger.
RUNNER_BUILDKITE_BUILDis only available forNO_SOURCEsource type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see Tutorial: Configure a CodeBuild-hosted Buildkite runner in the CodeBuild user guide. -
manual_creation(Optional[WrapperBoolean], default:None) –If manualCreation is true, CodeBuild doesn't create a webhook in GitHub and instead returns
payloadUrlandsecretvalues for the webhook. ThepayloadUrlandsecretvalues in the output can be used to manually create a webhook within GitHub.manualCreationis only available for GitHub webhooks. -
scope_configuration(Optional[ScopeConfiguration], default:None) –The scope configuration for global or organization webhooks.
Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.
-
pull_request_build_policy(Optional[PullRequestBuildPolicy], default:None) –A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.
Raises:
-
InvalidInputException–The input value that was provided is not valid.
-
OAuthProviderException–There was a problem with the underlying OAuth provider.
-
ResourceAlreadyExistsException–The specified Amazon Web Services resource cannot be created, because an Amazon Web Services resource with the same settings already exists.
-
ResourceNotFoundException–The specified Amazon Web Services resource cannot be found.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_codebuild/_services/code_build.py
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 | |