title: How do you pass environment variables from the Source to the Build in AWS CodePipelines?
body: <p>In AWS CodeBuild, it's incredibly easy to pass environment variables, as shown in <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html" rel="nofollow noreferrer">the documentation</a>. If I want to get the event trigger reference, I can use the variable <code>CODEBUILD_WEBHOOK_TRIGGER</code>, which is context-sensitive: for a GitHub <code>PUSH</code> event, this will be the branch name, but for a <code>PULL_REQUEST_CREATED</code> or <code>PULL_REQUEST_UPDATED</code> event, this will be the PR number.</p>
  
  <p>So the problem is this: when using AWS CodePipeline, the CodeBuild project "source" is the CodePipeline instead of the GitHub webhook. Suddenly, <code>CODEBUILD_WEBHOOK_TRIGGER</code> is an empty string and doesn't seem to know about anything about the original GitHub webhook event that triggered the CodePipeline.</p>
  
  <p>How does one access those environment variables using a CodeBuild project that is triggered by a CodePipeline? It seems to be a use case that AWS overlooked, so it might be a bug. Unfortunately, very difficult to submit a bug report with only a basic access account.</p>