Trigger build via API using PR number

Back then using v1, users were able to trigger build for PR using PR number. - For example, 

curl -X POST --header "Content-Type: application/json" -u $CIRCLE_TOKEN -d '{ "branch" : "pull/2"}' https://circleci.com/api/v2/project/<vcs>/<username>/<project>/pipeline

It's not anymore available for v2 and this function should be supported for PR builds.

  • Guest
  • Dec 16 2019
  • New
API
  • Attach files
  • Eric Alford commented
    27 Feb 23:58

    +1 On this for sure. I'm very surprised this isn't already supported when other solutions support this. Its basically a staple for CI.

  • CHING YANG TSENG commented
    December 20, 2019 10:12

    +1!!!!!    We have several repositories with the requirement for the conditional workflow which includes in the V2 API. As above,  Our workflow of projects rely heavily on PR rather than branching. With this feature backporting, I could have all the repositories on CircleCI rather than considering other solutions.

  • Ken Zhu commented
    December 17, 2019 03:40

    +1 for this. In my organisation we use PR a lot compared with branching. This will help more people to fully switch to v2 than using a combination of v1 + v2.