Skip to content

Conversation

@ribalba
Copy link
Member

@ribalba ribalba commented Dec 8, 2025

No description provided.

@ribalba ribalba requested a review from ArneTR December 8, 2025 13:41
Copy link
Member

@ArneTR ArneTR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is a bit uneasy to read as it is very full of guard clauses and method extractions but overall looks apt for the job.

I added some questions and annotations. After that ready to merge IMHO

tmp_path = path + ".tmp"
with open(tmp_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2, sort_keys=True)
os.replace(tmp_path, path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the use of the tmp file? if a disk error happens it can happen either in the write or in the replace function ... not? So why the increased complexity?

Copy link
Member Author

@ribalba ribalba Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because like this it is an atomic operation. It was generated like this and I quite liked the pattern. Changed

if branch:
params["sha"] = branch
try:
resp = requests.get(api_url, params=params, timeout=timeout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you not using the APIClient here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return codes are different. In API client I want to know what fails, here I just error if GitHub goes down.

if branch:
params["ref_name"] = branch
try:
resp = requests.get(api_url, params=params, timeout=timeout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you not using the APIClient here?

@@ -0,0 +1,22 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be a file that is rather a config.json.example and the actual config.json ignored in .gitignore?


if isinstance(vars_cfg, dict) and vars_cfg:
for k, v in vars_cfg.items():
if v == "__GIT_HASH__":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would document that you can use this "magic variable" in your usage scenario. It might not be directly clear from the config.json.example

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Point. Added to the readme

)
p.add_argument(
"--state",
default="repo_state.json",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to .gitignore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants