iWarrior
iWarrior

Reputation: 195

Travis-CI, how to get committer_email, author_name, within after_script command

I know committer_email, author_name, and load of other variables are part of the notification event. Is it possible to get access to them in earlier events like before_script, after_script?

I would like to get access of the information and add it directly to my test results. Having build information, test result information, and github repo information in the same file would be great.

Upvotes: 6

Views: 1626

Answers (1)

набиячлэвэли
набиячлэвэли

Reputation: 4677

You can extract committer e-mail, author name, etc. to environment variables using git log with --pretty, e.g.

export COMMITTER_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty="%cE")"
export AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")"

On Travis one'd put this in the before_install or before_script stage.

TRAVIS_COMMIT environment variable is provided by default.

Upvotes: 13

Related Questions