If working on github issues is to be time logged using ERPNext. It becomes easy if issues are pulled into ERPNext tasks using Github API.
Gi2Et is named by @gvrvnk
https://gaurav-naik.github.io/gi2et/
2 Likes
I’m interested by the idea. There is a patch for the known bug ?
I could pull issues from github repos.
You need to generate a API token Sign in to GitHub · GitHub
Set the token in settings Gi2Et Settings
While adding a project, add the github url of the project.
Use Task Sync Tool. Gi2Et Task Sync
Also solved the ascii issue. Not working with frappe/bench repo · Issue #5 · gaurav-naik/gi2et · GitHub
Test it out and suggest how it can be part of ERPNext on the github issue Sync Issues from a specific project with Git/Bitbucket Issues [Tracking] · Issue #8669 · frappe/erpnext · GitHub
We actually host our Git Server so how could I do ? Because there’s no API Token then
I developed the app for pulling github issues specifically
from frappe import _
@frappe.whitelist()
def get_gh_issues(gh_url=None):
out = []
headers = {'Authorization': 'token %s' % frappe.db.get_single_value("Gi2Et Settings", "api_token")}
if gh_url:
search_url = re.search('^https:\/\/github\.com\/(.*)\/(.*)', gh_url)
owner = search_url.group(1)
repo = search_url.group(2)
r = requests.get("https://api.github.com/repos/{owner}/{repo}/issues?state=all&per_page=100".format(owner=owner, repo=repo), headers=headers if headers else None)
if r.headers.get("Link"):
total_pages = int(re.search('.*page=(.+?)>; rel=\"last\"', r.headers.get("Link")).group(1))
else:
total_pages = 1
for x in xrange(total_pages):
r_page = requests.get("https://api.github.com/repos/{owner}/{repo}/issues?state=all&per_page=100&{page}".format(owner=owner, repo=repo, page=x+1), headers=headers if headers else None)
out_dict = r_page.json()
for issue in out_dict:
if not issue.get("pull_request"):
It needs to be modified for other hosts. gitlab has similar authentication methods as github.
Assumption is git host is web app with REST API
If you can suggest any UI/UX for
How to connect to different git hosts?
How to add git host specific endpoint?
how to enable / disable this feature.?
Sync Tool not required, button on project can be added directly?
any other suggestions
is it possible to call sync via API, or have a cronjob running to automatically pull from github regularly?
It is manual now. You’ve select project and sync.