3
我知道committer_email,author_name和其他變量的加載是通知事件的一部分。是否有可能在before_script,after_script等早期事件中訪問它們?Travis-CI,如何在after_script命令中獲取committer_email,author_name
我想獲取信息並將其直接添加到我的測試結果中。在同一個文件中構建信息,測試結果信息和github回購信息會很好。
我知道committer_email,author_name和其他變量的加載是通知事件的一部分。是否有可能在before_script,after_script等早期事件中訪問它們?Travis-CI,如何在after_script命令中獲取committer_email,author_name
我想獲取信息並將其直接添加到我的測試結果中。在同一個文件中構建信息,測試結果信息和github回購信息會很好。
您可以使用git log
with --pretty
(例如,)來提取提交者電子郵件,作者姓名等環境變量。
export COMMITTER_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty="%cE")"
export AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")"
On Travis one'd把這個放在before_install
or before_script
階段。
TRAVIS_COMMIT
環境變量是provided by default。
http://docs.travis-ci.com/user/environment-variables? –
我看着環境變量,但作者和電子郵件不在那裏。 – iWarrior
您可以通過'export COMMITTER_EMAIL =「$(git log -1 $ TRAVIS_COMMIT --pretty =」%aE「)」'([''--pretty'的參數(https://docs.travis- ci.com/user/environment-variables)) –