Skip to content

Commit

Permalink
alert temp logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kieronellis committed Jul 8, 2022
1 parent d7af4df commit 23416d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions action/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "```")
Expand Down
10 changes: 10 additions & 0 deletions action/alert_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "```")
Expand Down

0 comments on commit 23416d8

Please sign in to comment.