Skip to content

Commit 6d5a2ce

Browse files
committed
git-issues-blog v0.1: bugfix
1 parent ed2d617 commit 6d5a2ce

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
FROM python:3.7.3
1+
FROM alpine:3.7
22

33
LABEL author="Sep0lkit <sep0lkit@gmail.com>"
44
LABEL repository="https://github.com/Sep0lkit/git-issues-blog"
55

6+
# Github action labels
67
LABEL com.github.actions.name="git-issues-blog"
78
LABEL com.github.actions.description="Auto build issues blog from github repo"
89
LABEL com.github.actions.icon="file-text"
910
LABEL com.github.actions.color="blue"
1011

11-
COPY requirements.txt /tmp/
12-
RUN pip install --requirement /tmp/requirements.txt
12+
# Install packages
13+
RUN apk add --no-cache bash git jq
14+
RUN apk add --no-cache python3 && python3 -m ensurepip && pip3 --no-cache-dir install --upgrade pip
15+
RUN pip3 install requests PyGithub pathlib
16+
1317

1418
COPY git-issues-blog.py /git-issues-blog.py
15-
COPY git_diff_files.txt /git_diff_files.txt
1619
RUN chmod +x /git-issues-blog.py
1720
ENTRYPOINT [ "/git-issues-blog.py" ]

git-issues-blog.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,16 @@
3838
with open(POST_INDEX_FILE, encoding='utf-8', mode = 'r') as f:
3939
dictionary = json.load(f)
4040
lastcommit = dictionary['__commit__']
41+
command = "git diff --name-only -z " + lastcommit
42+
changed = subprocess.check_output(command)
43+
for x in changed.split(b'\x00'):
44+
if x.decode('utf-8'):
45+
CHANGED.append(x.decode('utf-8'))
4146
f.close()
4247
except Exception as e:
4348
print('%s load error: %s' % (POST_INDEX_FILE, e))
4449
exit(-1)
4550

46-
# load changed fie list from git_diff_files.txt
47-
try:
48-
with open('git_diff_files.txt', encoding='utf-8', mode = 'r') as f:
49-
for line in f:
50-
if line.strip() != "":
51-
CHANGED.append(line.strip())
52-
f.close()
53-
except:
54-
print('no changed file found')
55-
CHANGED = []
5651

5752
p = pathlib.Path(POSTS_PATH)
5853
for f in p.rglob('*.md'):

0 commit comments

Comments
 (0)