fix saving blackouts.json
This commit is contained in:
10
main.py
10
main.py
@@ -7,7 +7,7 @@ BARGHEMAN_TOKEN = os.getenv("BARGHEMAN_TOKEN")
|
||||
EITAAYAR_TOKEN = os.getenv("EITAAYAR_TOKEN")
|
||||
CHAT_ID = os.getenv("CHAT_ID")
|
||||
BILL_IDS = os.getenv("BILL_IDS", "").split(",")
|
||||
BLACKOUTS_FILE = "blackouts.json"
|
||||
BLACKOUTS_FILE = os.getenv("BLACKOUTS_FILE")
|
||||
|
||||
if not BARGHEMAN_TOKEN or not EITAAYAR_TOKEN or not CHAT_ID or len(BILL_IDS) == 0:
|
||||
raise EnvironmentError("Environment is not ready!")
|
||||
@@ -91,13 +91,7 @@ def main() -> None:
|
||||
if new_entries:
|
||||
updated_data[bill_id] = old_blackouts + new_entries
|
||||
|
||||
if updated_data != previous_data:
|
||||
save_blackouts(updated_data)
|
||||
os.system("git config --global user.name 'github-actions'")
|
||||
os.system("git config --global user.email 'github-actions@github.com'")
|
||||
os.system("git add " + BLACKOUTS_FILE)
|
||||
os.system("git commit -m 'Update outage data'")
|
||||
os.system("git push")
|
||||
save_blackouts(updated_data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user