todo-to-issue-action/LocalClient.py
Robert Alonso 714153eaf3 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
2024-10-25 00:07:47 +00:00

17 lines
471 B
Python

import subprocess
class LocalClient(object):
def __init__(self):
self.diff_url = None
self.commits = ['placeholder'] # content doesn't matter, just length
self.insert_issue_urls = False
def get_last_diff(self):
return subprocess.run(['git', 'diff', 'HEAD^..HEAD'], stdout=subprocess.PIPE).stdout.decode('utf-8')
def create_issue(self, issue):
return [201, None]
def close_issue(self, issue):
return 200