Skip to content

Commit c97668a

Browse files
committed
send logs to stderr
most logs are sent to stderr (important for using pipe to capture output), but a few recent print statements were missed
1 parent bbd6ee5 commit c97668a

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎github_activity/github_activity.py‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ def _get_datetime_from_git_ref(org, repo, ref, token):
944944
except requests.exceptions.HTTPError:
945945
try:
946946
data = response.json()
947-
print(f"\n!! GitHub error: {data['message']}\n")
947+
print(f"\n!! GitHub error: {data['message']}\n", file=sys.stderr)
948948
except Exception:
949949
pass
950950
raise
@@ -963,20 +963,25 @@ def _get_latest_release_tag(org, repo):
963963
"--json",
964964
"tagName,name,publishedAt",
965965
]
966-
print(f"Auto-detecting latest release tag for: {org}/{repo}")
967-
print(f"Running command: {' '.join(cmd)}")
966+
print(f"Auto-detecting latest release tag for: {org}/{repo}", file=sys.stderr)
967+
print(f"Running command: {' '.join(cmd)}", file=sys.stderr)
968968
out = run(cmd, stdout=PIPE)
969969
try:
970970
json = out.stdout.decode()
971971
release_data = loads(json)
972972
tag = release_data["tagName"]
973973
release = release_data["name"]
974974
published_at = release_data["publishedAt"]
975-
print(f"Using tag {tag} from release {release} published at {published_at}")
975+
print(
976+
f"Using tag {tag} from release {release} published at {published_at}",
977+
file=sys.stderr,
978+
)
976979
return tag
977980
except Exception as e:
978-
print(f"Error getting latest release tag for {org}/{repo}: {e}")
979-
print("Reverting to using latest local git tag...")
981+
print(
982+
f"Error getting latest release tag for {org}/{repo}: {e}", file=sys.stderr
983+
)
984+
print("Reverting to using latest local git tag...", file=sys.stderr)
980985
out = run("git describe --tags".split(), stdout=PIPE)
981986
tag = out.stdout.decode().rsplit("-", 2)[0]
982987
return tag

0 commit comments

Comments
 (0)