Skip to content

Commit

Permalink
Add some debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JordonPhillips committed Nov 13, 2024
1 parent e1d0283 commit 3050ecb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/tool/amend.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ def amend(

amended_files = True
if commit:
print(f"Staging amended file: {change_file}")
subprocess.run(f"git add {change_file}", check=True, shell=True)

if commit and amended_files:
print("Committing amended changelog entries")
subprocess.run(
f'git commit -m "Add PR link to changelog for #{pr_number}"',
check=True,
shell=True,
)

if push:
print("Pushing amended changelog entries")
subprocess.run(f"git push", check=True, shell=True)


Expand Down Expand Up @@ -71,10 +74,12 @@ def get_new_changes(base: str | None) -> dict[Path, Change]:
result = subprocess.run(
f"git diff {base} --name-only", check=True, shell=True, capture_output=True
)
print(f"DISCOVERED CHANGES:\n\n{result.stdout.decode('utf-8')}")
new_changes: dict[Path, Change] = {}
for changed_file in result.stdout.decode("utf-8").splitlines():
stripped = changed_file.strip()
if stripped.startswith(".changes/next-release") and stripped.endswith(".json"):
file = REPO_ROOT / stripped
new_changes[file] = Change.from_json(json.loads(file.read_text()))
print(f"NEWLY CHANGED CHANGELOG ENTRIES: {len(new_changes)} - {", ".join([str(p) for p in new_changes.keys()])}")
return new_changes

0 comments on commit 3050ecb

Please sign in to comment.