get GitHub git branch for AWS CodeBuild

前端 未结 5 1861
鱼传尺愫
鱼传尺愫 2021-02-07 08:15

I\'m setup AWS CodeBuild to build automatically from GitHub. Other CI services provide an environment variable for the branch, but I can\'t find one for AWS CodeBuild. There is

5条回答
  •  耶瑟儿~
    2021-02-07 08:52

    Add the following command to the install or pre_build phase of your buildspec.yml:

    bash -c "$(curl -fsSL https://raw.githubusercontent.com/thii/aws-codebuild-extras/master/install)"

    You can get more information about the build via the following environment variables: CI, CODEBUILD, CODEBUILD_GIT_AUTHOR, CODEBUILD_GIT_AUTHOR_EMAIL, CODEBUILD_GIT_BRANCH, CODEBUILD_GIT_COMMIT, CODEBUILD_GIT_MESSAGE, CODEBUILD_GIT_TAG, CODEBUILD_PROJECT, CODEBUILD_PULL_REQUEST.

提交回复
热议问题