Is there any way to programmatically (using libraries like PyGithub
, GitPython
or dulwich
) load any file right into MyRepo.wiki.git
repository? Using Python, of course.
I can easily upload a file right into MyRepo.git
repository with a help of PyGithub
, but, unfortunately, this library has no API or ways to work with MyRepo.wiki.git
repository.
Here is how I can upload a file to MyRepo.git
repository:
github_repo = github_account.get_user().get_repo('MyRepo')
head_ref = gh_repo.get_git_ref("heads/%s" % github_branch)
latest_commit = gh_repo.get_git_commit(head_ref.object.sha)
base_tree = latest_commit.tree
new_tree = gh_repo.create_git_tree(
[github.InputGitTreeElement(
path="test.txt",
mode='100755' if github_executable else '100644',
type='blob',
content="test"
)],
base_tree)
new_commit = gh_repo.create_git_commit(
message="test commit message",
parents=[latest_commit],
tree=new_tree)
head_ref.edit(sha=new_commit.sha, force=False)
So, how can I do the same but with MyRepo.wiki.git
repository? If you can provide an example using PyGithub library - it would be really great.
P.S. Can I do this using Gollum API?
P.P.S. Has not anybody worked with *.wiki.git
using any kind of python library? I do not believe :(
P.P.P.S. If I was not clear enough: I DO NOT want to create a local repository in any way. All I want to modify repo structure on-the-fly - just how my example does. But with *.wiki.git repository.
Thank you!
wiki
suffix. – Shaven...getRepo("myrepo.git")
, but this doesn't work with the following:...getRepo("myrepo.wiki.git")
. Please, note, I indeed can use git tool but I want to do everything from Python library. – Shavenget_repos()
function (in case ofPyGithub
). But*.wiki.git
repository is not included in that list. The only way I can find out if the repo has a Wiki, is request the found repo usinghas_wiki
property:repo.has_wiki
. And that's all :( – Shaven