Skip to content

Commit 2310467

Browse files
committed
calculate git sha for binary file
1 parent 03aaa45 commit 2310467

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ COPY --from=builder /opt/venv /opt/venv
1919
ENV PATH="/opt/venv/bin:$PATH"
2020
COPY ./src /app
2121
RUN rm -rf /app/test
22-
CMD ["python", "/app/main.py"]
22+
CMD ["python", "/app/src/main.py"]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ Run:
99
```
1010
docker run --rm -it \
1111
--env-file .env \
12-
--volume $(pwd)/src:/app \
12+
--volume $(pwd):/app \
1313
pygithub
1414
```

data/000001-42.600.2.tif

4.61 MB
Binary file not shown.

run.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
docker run --rm -it \
4+
--env-file .env \
5+
--volume $(pwd):/app \
6+
pygithub

src/main.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import base64
2+
import hashlib
23
import os
34
from pprint import pprint
45

@@ -9,18 +10,29 @@
910
def main(repo_token):
1011
gh = Github(repo_token)
1112

12-
repository = "josecelano/mandelbrot-explorer"
13+
repository = "Nautilus-Cyberneering/chinese-ideographs-website"
1314

14-
repo = gh.get_repo(repository)
15+
remote_repo = gh.get_repo(repository)
1516

16-
commit = repo.get_commit("0dd65f3241250afa591b4ef1d99eec92a59352e5")
17+
commit = remote_repo.get_commit("79c3511c1eba9329665dc64c1bd55ff4cffeb98b")
1718

1819
pprint(commit)
1920

20-
issue = repo.get_issue(number=1)
21+
issue = remote_repo.get_issue(number=1)
2122

2223
pprint(issue)
2324

25+
# 1 MB limit
26+
issue = remote_repo.get_contents(
27+
"public/images/.gitkeep", "issue-1-import-base-images")
28+
29+
local_repo = Repo("/app")
30+
31+
sha = local_repo.git.hash_object('data/000001-42.600.2.tif')
32+
33+
print("sha for data/000001-42.600.2.tif (git hash-object data/000001-42.600.2.tif)", sha)
34+
35+
2436
if __name__ == "__main__":
2537
# https://pygithub.readthedocs.io
2638
repo_token = os.environ["INPUT_REPO_TOKEN"]

0 commit comments

Comments
 (0)