From f7d8b8b08b8c2511672f2669e0da607c4e5fced4 Mon Sep 17 00:00:00 2001 From: James Greenhill Date: Mon, 25 Mar 2024 16:50:25 -0700 Subject: [PATCH] check env --- bin/hobby-ci.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/hobby-ci.py b/bin/hobby-ci.py index b2620dcd48927..22cc91e6fb952 100644 --- a/bin/hobby-ci.py +++ b/bin/hobby-ci.py @@ -189,14 +189,19 @@ def handle_sigint(self): self.destroy_self() def export_droplet(self): - if self.droplet: - with open("$GITHUB_ENV", "a") as env_file: - env_file.write(f"HOBBY_DROPLET_ID={self.droplet.id}\n") - if self.record: - with open("$GITHUB_ENV", "a") as env_file: - env_file.write(f"HOBBY_DNS_RECORD_ID={self.record['domain_record']['id']}\n") - env_file.write(f"HOBBY_DNS_RECORD_NAME={self.record['domain_record']['name']}\n") - env_file.write(f"HOBBY_NAME={self.name}\n") + if not self.droplet or not self.record: + return + record_id = self.record["domain_record"]["id"] + record_name = self.record["domain_record"]["name"] + droplet_id = self.droplet.id + + print(f"Exporting the droplet ID: {self.droplet.id} and DNS record ID: {record_id}") + with open("$GITHUB_ENV", "a") as env_file: + env_file.write(f"HOBBY_DROPLET_ID={droplet_id}\n") + with open("$GITHUB_ENV", "a") as env_file: + env_file.write(f"HOBBY_DNS_RECORD_ID={record_id}\n") + env_file.write(f"HOBBY_DNS_RECORD_NAME={record_name}\n") + env_file.write(f"HOBBY_NAME={self.name}\n") def ensure_droplet(self, ssh_enabled=True): self.create_droplet(ssh_enabled=ssh_enabled)