Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub api #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions python/pygithub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM indigodatacloud/ci-images:python

LABEL maintainer="[email protected]"

RUN pip install PyGithub

COPY *.py /usr/local/bin/
RUN chmod +x /usr/local/bin/*.py

# Standard SSH port
EXPOSE 22

# Default command
CMD ["/usr/sbin/sshd", "-D"]
22 changes: 22 additions & 0 deletions python/pygithub/checkCitable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python
from github import Github
from github import GithubException
import sys

def isPathInRepository(repo,path):
try:
repo.get_contents(path)
print("Found %s in repository %s"%(path,repo.name))
return True
except GithubException:
print("%s not found in repository %s"%(path,repo.name))
return False

g = Github()
# In case an access token is needed
#g = Github("access_token")
repo = g.get_repo(sys.argv[1])

assert(isPathInRepository(repo,"CITATION.json") or isPathInRepository(repo,"codemeta.json"))


16 changes: 16 additions & 0 deletions python/pygithub/checkLicense.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/python
from github import Github
from github import GithubException
import sys

g = Github()
# In case an access token is needed
#g = Github("access_token")

repo = g.get_repo(sys.argv[1])
try:
license = repo.get_license()
print("Found license for repository %s: %s" %(repo.name,license.license))
except GithubException:
print("License not found in repository")