1
0
telegram-action/main.py

42 lines
1.0 KiB
Python
Raw Normal View History

2022-07-15 14:52:54 +02:00
import os
from message import Message
from environments import Environment
2022-11-23 19:29:10 +01:00
chat_id = os.getenv('CHAT_ID')
if chat_id == "" or chat_id is None:
2022-07-15 14:52:54 +02:00
raise SystemExit('Variable chat_id is required. Exit.')
2022-11-23 19:29:10 +01:00
token = os.getenv('TOKEN')
if token == "" or token is None:
raise SystemExit('Variable token is required. Exit.')
status = os.getenv('STATUS')
commit = os.getenv('COMMIT_MESSAGE')
include_commit_info = os.getenv('INCLUDE_COMMIT_INFO')
docker_tags = os.getenv('DOCKER_TAGS')
custom_message = os.getenv('MESSAGE')
2022-07-15 14:52:54 +02:00
#GitHub environment variables
2022-11-23 19:29:10 +01:00
github_workflow = os.getenv('WORKFLOW')
github_repository = os.getenv('REPOSITORY')
github_sha = os.getenv('SHA')
github_actor = os.getenv('ACTOR')
2023-09-23 21:30:42 +02:00
github_run_id = os.getenv('GITHUB_RUN_ID')
2022-11-23 19:29:10 +01:00
tag = os.getenv('TAG')
2022-07-15 14:52:54 +02:00
envs = Environment(
chat_id,
token,
status,
commit,
include_commit_info,
docker_tags,
custom_message,
github_workflow,
github_repository,
github_sha,
github_actor,
2023-09-23 21:30:42 +02:00
github_run_id,
2022-07-15 14:52:54 +02:00
tag
)
message = Message(envs)
message.send_message()