mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
releaser: refactor; add func GetGitHubAPIHandler
This commit is contained in:
@@ -62,15 +62,13 @@ def GetListOfArtifacts(argv):
|
||||
return files
|
||||
|
||||
|
||||
files = GetListOfArtifacts(sys_argv)
|
||||
|
||||
|
||||
def GetGitHubAPIHandler():
|
||||
print("· Get GitHub API handler (authenticate)")
|
||||
|
||||
if "GITHUB_TOKEN" in environ:
|
||||
gh = Github(environ["GITHUB_TOKEN"])
|
||||
return Github(environ["GITHUB_TOKEN"])
|
||||
elif "INPUT_TOKEN" in environ:
|
||||
gh = Github(environ["INPUT_TOKEN"])
|
||||
return Github(environ["INPUT_TOKEN"])
|
||||
else:
|
||||
if "GITHUB_USER" not in environ or "GITHUB_PASS" not in environ:
|
||||
stdout.flush()
|
||||
@@ -79,7 +77,12 @@ else:
|
||||
"Need credentials to authenticate! Please, provide 'GITHUB_TOKEN', 'INPUT_TOKEN', or 'GITHUB_USER' and 'GITHUB_PASS'"
|
||||
)
|
||||
)
|
||||
gh = Github(environ["GITHUB_USER"], environ["GITHUB_PASS"])
|
||||
return Github(environ["GITHUB_USER"], environ["GITHUB_PASS"])
|
||||
|
||||
|
||||
files = GetListOfArtifacts(sys_argv)
|
||||
gh = GetGitHubAPIHandler()
|
||||
|
||||
|
||||
print("· Get Repository handler")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user