According to the documentation, CIRCLE_USERNAME is “The GitHub login of the user who either pushed the code to GitHub or triggered the build from the UI/API”
But when triggering a build using the API, I think the environment variable CIRCLE_USERNAME is empty.