diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 1ef7568c..676853fd 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -52,6 +52,10 @@ jobs: id: commit uses: pr-mpt/actions-commit-hash@v1 + - name: 'Save Commit Long Hash to TXT File' + run: | + echo ${{ steps.commit.outputs.long }}>"commit_sha.txt" + - name: 'Build and push Docker image' uses: docker/build-push-action@v3 with: diff --git a/api/utils.py b/api/utils.py index 355dd77b..d9314615 100644 --- a/api/utils.py +++ b/api/utils.py @@ -118,6 +118,11 @@ def get_commit_robosats(): commit = os.popen('git log -n 1 --pretty=format:"%H"') commit_hash = commit.read() + # .git folder is included in .dockerignore. But automatic build will drop in a commit_sha.txt file on root + if commit_hash == None or commit_hash =="": + with open("commit_sha.txt") as f: + commit_hash = f.read() + return commit_hash premium_percentile = {}