Quantcast
Channel: CircleCI Discuss - Latest posts
Viewing all articles
Browse latest Browse all 14879

Problem with pass CIRCLE_BRANCH variable to POST body

$
0
0

hi, I have the code in my config file:

run:
command: |
if [ "$CIRCLE_BRANCH" = "test_branch" ] || [ "$CIRCLE_BRANCH" = "master" ]; then

               curl -X POST \
               --header "Circle-Token: $CIRCLECI_API_TOKEN" \
               --header 'Accept: application/json' \
               --header 'Content-Type: application/json' \
               --url https://circleci.com/api/v2/project/bitbucket/......... \
               --data '{ "branch": "$CIRCLE_BRANCH" }'     
 fi  

When I pass test_branch or master directly like this --data '{ "branch": "master" }'
It works fine. But I need to pass a parameter like above. When I run the config with parameter, I see info: Branch not found
I have tried "${CIRCLE_BRANCH}" also but does not work

Could you tell me how to pass a generic value there ?


Viewing all articles
Browse latest Browse all 14879

Latest Images

Trending Articles



Latest Images