Skip to content

Commit 9fe33a3

Browse files
Merge pull request #280 from Root-Core/ci_fix_gamefix_checks
CI: fix gamefix check generator
2 parents aa82b07 + b39f418 commit 9fe33a3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/scripts/check_gamefixes.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ def check_steamfixes(project: Path) -> None:
3535
invalid_appids = set()
3636

3737
for appids in _batch_generator(project.joinpath('gamefixes-steam'), 50):
38-
appids = {int(x) for x in appids}
38+
# If no more ids are produced by the generator, stop processing.
39+
if not appids:
40+
continue
3941

42+
appids = {int(x) for x in appids}
4043
steam_appids = steam.get_valid_appids(appids)
4144

4245
# If an ID doesn't exist in the Steam result then it's invalid
@@ -58,6 +61,10 @@ def check_gogfixes(project: Path, url: str, api: ApiEndpoint) -> None:
5861
# Find all IDs in batches of 50. The gog api enforces 50 ids per request
5962
# See https://gogapidocs.readthedocs.io/en/latest/galaxy.html#get--products
6063
for gogids in _batch_generator(project.joinpath('gamefixes-gog')):
64+
# If no more ids are produced by the generator, stop processing.
65+
if not gogids:
66+
continue
67+
6168
sep = '%2C' # Required comma separator character. See the docs.
6269
appids = gogids.copy()
6370

@@ -124,13 +131,13 @@ def _batch_generator(gamefix: Path, size: int = 50) -> Generator[set[str], Any,
124131
if is_steam and not appid.isnumeric():
125132
continue
126133

134+
count += 1
127135
appids.add(appid)
128136
if count == size:
129137
yield appids
130138
appids.clear()
131139
count = 0
132140
continue
133-
count += 1
134141

135142
yield appids
136143

0 commit comments

Comments
 (0)