Skip to content

Commit

Permalink
logging and echo myvar
Browse files Browse the repository at this point in the history
  • Loading branch information
kieronellis committed Jul 8, 2022
1 parent 4b5f005 commit fb077cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions action/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
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)

g = Github(repo_token)
repo = g.get_repo(os.getenv('GITHUB_REPOSITORY'))
logging.info(repo)
event_payload = open(os.getenv('GITHUB_EVENT_PATH')).read()
json_payload = json.loads(event_payload)
logging.info(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
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ airflow variables import $3

cp -r /action/* /github/workspace/

ls

python -m pytest dag_validation.py -s -q >> result.log
my_var=`echo Pytest exited $?`
echo $my_var
python alert.py --log_filename=result.log --repo_token=$4
if [ "$my_var" != "Pytest exited 0" ]; then echo "Pytest did not exit 0" ;fi
if [ "$my_var" != "Pytest exited 0" ]; then exit 1 ;fi

0 comments on commit fb077cd

Please sign in to comment.