From 23416d884c4c2ec97ef5bbf9a24e06c65f31f0be Mon Sep 17 00:00:00 2001 From: kieronellis <69465049+kieronellis@users.noreply.github.com> Date: Fri, 8 Jul 2022 17:33:50 +0200 Subject: [PATCH] alert temp logging --- action/alert.py | 2 ++ action/alert_temp.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/action/alert.py b/action/alert.py index dc25494..1f6d940 100644 --- a/action/alert.py +++ b/action/alert.py @@ -25,10 +25,12 @@ def comment_pr(repo_token, filename): repo = g.get_repo(os.getenv('GITHUB_REPOSITORY')) logging.info(repo) print(repo) + event_payload = open(os.getenv('GITHUB_EVENT_PATH')).read() json_payload = json.loads(event_payload) logging.info(json_payload) print(json_payload) + if json_payload.get('number') is not None: pr = repo.get_pull(json_payload.get('number')) pr.create_issue_comment("```" + message + "```") diff --git a/action/alert_temp.py b/action/alert_temp.py index f244f2b..4be4786 100644 --- a/action/alert_temp.py +++ b/action/alert_temp.py @@ -10,16 +10,26 @@ import argparse from github import Github +import logging + def comment_pr(repo_token, filename): file = open(filename, encoding='utf-8') message = file.read() message = message.encode("ascii", "ignore").decode('utf-8') + logging.info(message) + print(message) + g = Github(repo_token) repo = g.get_repo(os.getenv('GITHUB_REPOSITORY')) + logging.info(repo) + print(repo) event_payload = open(os.getenv('GITHUB_EVENT_PATH')).read() json_payload = json.loads(event_payload) + logging.info(json_payload) + print(json_payload) + if json_payload.get('number') is not None: pr = repo.get_pull(json_payload.get('number')) pr.create_issue_comment("```" + message + "```")