Add some debug statements

This should make future debugging requests easier, since the cargo audit
command and the resulting JSON are directly accessible.
This commit is contained in:
Jonas Bushart
2022-12-22 21:33:06 +01:00
parent cf4c31eba1
commit bf3d0bcece

View File

@@ -15,6 +15,12 @@ import requests
TIMEOUT = 30
def debug(message: str) -> None:
"""Print a debug message to the GitHub Action log"""
newline = "\n"
print(f"""::debug::{message.replace(newline, " ")}""")
class Issue:
"""Basic Issue model for collecting the necessary info to send to GitHub."""
@@ -193,6 +199,7 @@ class GitHubClient:
"page": page,
"state": "open",
}
debug(f"Fetching existing issues from GitHub: {page=}")
list_issues_request = requests.get(
self.issues_url, headers=self.issue_headers, params=params, timeout=TIMEOUT
)
@@ -327,12 +334,15 @@ def run() -> None:
extra_args.append("--deny")
extra_args.append("warnings")
audit_cmd = ["cargo", "audit", "--json"] + extra_args + ignore_args
debug(f"Running command: {audit_cmd}")
completed = subprocess.run(
["cargo", "audit", "--json"] + extra_args + ignore_args,
audit_cmd,
capture_output=True,
text=True,
check=False,
)
debug(f"Command output: {completed.stdout}")
data = json.loads(completed.stdout)
summary = create_summary(data)