IBM Cloud Docs
Using the Stage Results API in custom scripts

Using the Stage Results API in custom scripts

You can use the Stage Results API to access the results of specific stages and custom stages.

  1. Type get_data result to print which stages have saved results:
   $ get_data result
   test
   detect-secrets
   branch-protection
  1. Type get_data result <stage-name> to print the result for a specific stage:
   $ get_data result detect-secrets
   success
   $ get_data result test
   failure
  1. Iterate through the saved results:
   #!/usr/bin/env bash
   while read -r stage; do
         result=$(get_data result $stage)
         echo "The result of '$stage' stage is: '$result'"
   done < <(get_data result)

Outputs the following lines to the console:

    The result of 'detect-secrets' stage is: 'success'
    The result of 'branch-protection' stage is: 'success'