Abbreviated commit sha1 env variable?

envars
circle.yml

#1

What’s the best way to get an abbreviated git commit sha1 in your build environment using circle.yml?

Wanting the following:

git rev-parse --short HEAD
6bb413b

Cheers!


#2

To get this you can add to circle.yml:

machine:
  environment:
    SHORT_GIT_HASH: $(echo $CIRCLE_SHA1 | cut -c -7)

#3

Perfect. Thanks @tom


#4

This does not work in version 2.


#5