Skip to content

Commit ce7ba0c

Browse files
committed
Use a separate json file to pass update info for issue generation
1 parent 18c54aa commit ce7ba0c

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.github/workflows/check-for-updates.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363
- name: Upload artifact
6464
uses: actions/upload-artifact@v4
6565
with:
66-
name: latest_update
67-
path: ./latest_update.json
66+
name: full_update_info
67+
path: ./full_update_info.json
6868

6969
create-issue:
7070
needs: check-for-updates
@@ -75,11 +75,11 @@ jobs:
7575
- name: Download artifact
7676
uses: actions/download-artifact@v4
7777
with:
78-
name: latest_update
78+
name: full_update_info
7979

8080
- name: Get data from json
8181
id: get_data
82-
run: echo "json_data=$(cat latest_update.json)" >> $GITHUB_OUTPUT
82+
run: echo "json_data=$(cat full_update_info.json)" >> $GITHUB_OUTPUT
8383

8484
- name: Print data
8585
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ wheels/
88

99
# Virtual environments
1010
.venv
11+
12+
full_update_info.json

main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
df_app_id = 975370
1010

1111
root_dir = Path(__file__).parent
12-
output_file = root_dir / "latest_update.json"
12+
latest_update_file = root_dir / "latest_update.json"
13+
full_update_info_file = root_dir / "full_update_info.json"
1314

1415

1516
def get_last_posts(*, count) -> list[dict[str, Any]]:
@@ -32,17 +33,18 @@ def main():
3233
posts = get_last_posts(count=1)
3334
post = posts[0]
3435

35-
if output_file.exists():
36-
prev_update = json.loads(output_file.read_text(encoding="utf-8"))
36+
if latest_update_file.exists():
37+
prev_update = json.loads(latest_update_file.read_text(encoding="utf-8"))
3738

38-
if is_update(post["title"]) and (not output_file.exists() or prev_update["date"] < post["date"]):
39+
if is_update(post["title"]) and (not latest_update_file.exists() or prev_update["date"] < post["date"]):
3940
prev_update = dict(
4041
gid=post["gid"],
4142
date=post["date"],
4243
title=post["title"],
4344
appid=post["appid"],
4445
)
45-
output_file.write_text(json.dumps(prev_update), encoding="utf-8")
46+
latest_update_file.write_text(json.dumps(prev_update), encoding="utf-8")
47+
full_update_info_file.write_text(json.dumps(post), encoding="utf-8")
4648
print("yes")
4749
else:
4850
print("no")

0 commit comments

Comments
 (0)