Use git to get SHA-1 of repo
It seems to me that this would be equivalent but shorter:

def get_sha():
    repo = os.listdir('.')[0]
    sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=repo).decode('ascii').strip()
    return sha


Because, . is essentially the same as os.environ['PWD'],
with the difference that it's not an absolute path.
Since subprocess.check_output(..., cwd=...) works fine with relative paths too,
I don't see the reason to use an absolute path, and so no need for PWD.

But more importantly,
I find it a bit odd that this script assumes that the first entry in the directory listing is a Git repository.
This setup seems a bit fragile.
It would be better to pass the repo path as a parameter to this function:

def get_sha(repo):
    sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=repo).decode('ascii').strip()
    return sha


Then you'd have something simple, clear, no questions asked.