AWS CodeBuild Console Start build with Webhook Events

0

Hello, My CodeBuild is failing to trigger on PUSH, PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED when I add "!refs/heads/main" in the HEAD_REF optional field.

Enter image description here

In the POST request json object, the head.ref value is "test_codebuild".

I'm trying to trigger the build when the branch is not the "main" branch. In the Github webhook response, I'm seeing the message "{"response":"No build triggered for specified payload","statusCode":200}".

Can someone point me to right direction if I only want to trigger the CodeBuild if is on a feature branch?

Thank you.

dc
asked 8 months ago252 views
1 Answer
0

I thought I would make the following regular expression and then build it with the changes to the feature branch.
Try changing the value of head.ref as follows.

^refs/heads/feature.*$
profile picture
EXPERT
answered 8 months ago
  • Which means that I have to name all the branches starting with "feature". I want to be able to name the branch as anything.

  • The following is a regular expression that will respond if it is not a main branch. Can you confirm that it works here?

    ^refs/heads/(?!main$).+
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions