Create PR upon successful build



I’m trying to send an API call to GitHub to create a PR if a branch starting with feature/ is successful.

    branch: /feature\/.*/
      - curl -X POST -H "Authorization: 'token $GITHUB_TOKEN'" -d "{'base':'master','head':'$CIRCLE_BRANCH','title':'Merge with $CIRCLE_BRANCH'}"$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls

I have tried a bunch of variations of this, but always getting less than straightforward error messages from the circle.yml parser. Is there something I’m clearly doing wrong?

Note: the build fails, not the API call.



First, we will only run deployment if the build passes.

Secondly, please be sure the branch matches your PR branch, you should see the command show up in the “deploy” phase of the build summary.

Also, are you able to create a PR using this curl outside of CI?