feat: add Local client

This is just a safe fallback for local testing.
If environment variables which activate the
creation of the GitHub client aren't set, then
the Local client is created. It acts on the most
recent commit of the repo in the working directory.

Minor edit to GitHubClient so that it raises an
EnvironmentError exception if INPUT_GITHUB_URL
environment variable is not defined. This allows
main to detect the error and fall back to trying
to use the Local client
This commit is contained in:
Robert Alonso
2024-10-24 22:55:44 +00:00
parent 662435d7fc
commit 714153eaf3
3 changed files with 29 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ class GitHubClient(object):
def __init__(self):
self.github_url = os.getenv('INPUT_GITHUB_URL')
if not self.github_url:
raise EnvironmentError
self.base_url = f'{self.github_url}/'
self.repos_url = f'{self.base_url}repos/'
self.repo = os.getenv('INPUT_REPO')