def commit_script(path, script):
"""Commit script string to GitHub repo."""
repository = get_repository()
try:
sha = repository.get_contents(path).sha
repository.update_file(
path=path,
message='Template update',
content=script,
sha=sha
)
except GithubException:
repository.create_file(
path=path,
message='Template initial commit',
content=script
)
logging.info("Initial commit of new file {}".format(path))
评论列表
文章目录