Make person who triggered a manual build available in an ENV variable

Here’s a bit of YAML to achieve the same using the Bitrise API in a pipeline. It’s certainly not as easy as an env var would be, but if you need it before an env var is (maybe) made available this can help

- script@1:
        title: Check for manual trigger
        inputs:
        - runner_bin: ruby
        - content: |-
            require "faraday"

            nightly_pl_params = {
                'workflow' => 'nightly',
                'branch' => ENV['BITRISE_GIT_BRANCH']
            }

            auth = {
                'Authorization' => ENV["BITRISE_ACCESS_TOKEN"]
            }

            conn = Faraday.new(
                url: "https://api.bitrise.io/v0.1/apps/#{ENV['BITRISE_APP_SLUG']}/",
                headers: auth
            ) do |f|
                f.request :json
                f.response :json
            end

            # Gets the list of nightly builds for the branch
            nightly_pl_builds = conn.get('builds', params=nightly_pl_params)

            if nightly_pl_builds.body['data'].length > 0
              triggered_by = nightly_pl_builds.body['data'][0]['triggered_by']
              puts "triggered_by: #{triggered_by}" # will be "manual-username" if manually triggered, "schedule" if scheduled etc.

              if triggered_by.start_with?("manual-")
                puts "Manual run detected
              else
                puts "Non-manual trigger detected
              end
            end