Michał Urbaniak
Michał Urbaniak

Reputation: 1344

How do I configure AWS CodeBuild to build only when push to master branch is made?

I am using a webhook to build my project on push requests. By default, AWS CodeBuild builds on push to every branch, however I would like to limit that to master - to trigger the build ONLY when push to master is made. How do I use the regex patterns to do that?

The AWS documentation is not really specific in terms of how to use the regular expressions there.

Upvotes: 11

Views: 7064

Answers (2)

Mark Adamson
Mark Adamson

Reputation: 888

Set the HEAD_REF setting to ^refs/heads/master$. They don't explicitly specify it for master branch in the docs but they do show the equivalent for 'branch1'

source: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-pull-request.html#sample-github-pull-request-filter-webhook-events-console

Upvotes: 19

Subin Mathew
Subin Mathew

Reputation: 2545

You can set the filter group on the webhook, as explained in the documentation @ https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-pull-request.html#sample-github-pull-request-filter-webhook-events-console

Upvotes: 2

Related Questions