Created
January 17, 2017 21:29
-
-
Save arush0311/0496cd5af13886712542cea7a71d5258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output, CalledProcessError | |
def get_commit_sha(): | |
try: | |
commit = check_output(['git', 'rev-parse', 'HEAD']) | |
commit += check_output(['git', 'status', '--porcelain']) | |
commit = commit.decode('utf-8').strip() | |
except (OSError, CalledProcessError) as e: | |
commit = '' | |
return commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment