How to: Abort workflow if previous build isn't "Green"?

I would like my build_nightlies scheduled job to only execute if the current branch is ‘green’. Is it possible to detect the build status of the branch and then start/stop a workflow based on that resut?

A bit more context:

I’ve got a run_tests job that runs all day long on every code push. I’ve also scheduled a build_nightlies job to run in the middle of the night, but I only want it to build things if the last run_tests job ran successfully.

I know I could set up a workflow to execute my run_tests and then build_nightlies jobs, but it’s unnecessary to execute run_tests again since that would just be redundant of the previous build.

You can use Bitrise API to query status of the latest run_tests build status at the beginning of the build_nightlies - eg. fail it if conditions are not met. https://api-docs.bitrise.io/

1 Like

Ah, didn’t know about that. Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.