I've been trying to find a way to access the scheme name from a Run Script build phase. I'm writing a CLI command that updates a user's Xcode project so I don't have the luxury of tinkering with the Xcode user interface. I have been using Cocoapod's Xcodeproj dependency to update the build settings.
The first port of call is Xcode's build settings environment variables which do not contain the scheme. See here: