Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggering Forked Pull Requests Pipeline #71

Closed
twslade opened this issue Sep 21, 2020 · 1 comment · Fixed by #72
Closed

Triggering Forked Pull Requests Pipeline #71

twslade opened this issue Sep 21, 2020 · 1 comment · Fixed by #72

Comments

@twslade
Copy link
Contributor

twslade commented Sep 21, 2020

Thanks for the great tool!

I'm seeing an issue trying to trigger builds for a pull request from a trusted fork. I've looked through the orb code and I'm seeing an issue with the branch name reference for the pipeline trigger.

trigger_workflow() {
curl --silent -X POST \
"https://circleci.com/api/v2/project/<< parameters.vcs-type >>/$<< parameters.user >>/$<< parameters.repo-name >>/pipeline?circle-token=${CIRCLE_TOKEN}" \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"branch": "'$CIRCLE_BRANCH'",
"parameters": << parameters.custom-parameters >>
}'
}

The branch I am trying to trigger is pull/610.

The response I get is Branch not found..

In the circle docs for triggering a pipeline they mention the following:

The branch where the pipeline ran. The HEAD commit on this branch was used for the pipeline. Note that branch and tag are mutually exclusive. To trigger a pipeline for a PR by number use pull/<number>/head for the PR ref or pull/<number>/merge for the merge ref (GitHub only).

I can trigger the build using the syntax:

curl --silent -X POST     "https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline?circle-token=${CIRCLE_TOKEN}"     
  -H 'Accept: */*'     
  -H 'Content-Type: application/json'     
  -d '{
        "branch": "'pull/610/head'",
        "parameters": '$custom_params'
    }

Is this something that can be added to this orb or should I look into doing some env modification before triggering the build?

@roopakv
Copy link
Owner

roopakv commented Sep 21, 2020

your PR looks good. lets just use the newer env vars adn we should be good to go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants