How to trigger a workflow in when another workflow is finished?

Hello,

In one of my applications, I need to trigger a workflow when another workflow is finished, is that possible ? If yes, how ?

Thanks

1 Like

Hi @eaappfactory,

Thanks for asking this here! :wink:

You definitely can do this, e.g. with a Script step. Just use the Bitrise Build Trigger API and start the other build with a curl command.

If you have any questions just let us know!

1 Like

I needed to trigger another workflow on created Bitbucket Pull Request and this is what did:

  • create a small Flask app that triggers Bitrise build
  • create webhook in bitbucket pointing to that app

Result: 1 build was triggered by Bitrise’s native bitbucket integration and another via additional webhook.

But I think what Viktor suggested is much simpler solution :slight_smile:

Hi! I have similar task. I have set up pull_request_check workflow and deploy_alpha_build workflow. I’d like to trigger deployment as soon as check is finished. I use curl ping step for that and curl command generated by bitrise web interface (start / scedule build button).

Here is how it looks like:

    - curl-ping@2:
        inputs:
        - ping_url: >-
            curl
            https://app.bitrise.io/app/xxxxxxxxxxxxxxxx/build/start.json
            --data '{"hook_info":{"type":"bitrise","build_trigger_token":"xxxxxxxxxxxxxxxxxxxxxx"},"build_params":{"branch":"$BITRISE_GIT_BRANCH","workflow_id":"deploy_alpha_build","environments":[{"mapped_to":"BITRISE_PULL_REQUEST","value":"$BITRISE_PULL_REQUEST","is_expand":true}]},"triggered_by":"curl"}'

First of all I need to pass BITRISE_PULL_REQUEST environment variable to be able to post the link to the build as a comment to pull request.
I also need to build from specific branch. The one which I want to merge in master.

Not sure if I do that correctly.

Hi @alex.edunov! Doesn’t seem incorrect, but you might have an easier time using a Bitrise Start Build step to launch the workflow!