Skip to content
Merged
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
17 changes: 13 additions & 4 deletions erpnext_github_integration/github_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,24 @@ def sync_repo(repository):
# Clear and update branches
repo_doc.set('branches_table', [])
for b in branches:
commit_date_str = b.get('timestamp') or b.get('commit', {}).get('committer', {}).get('date')
if commit_date_str:
commit_date = convert_github_datetime(commit_date_str)
branch_name = b.get('name')
commit_sha = b.get('commit', {}).get('sha')

if commit_sha:
# Fetch detailed commit info to get the date
commit_details = github_request('GET', f'/repos/{repo_full}/commits/{commit_sha}', token)
if commit_details:
# Now you can access the nested commit data
commit_date_str = commit_details.get('commit', {}).get('committer', {}).get('date')
if commit_date_str:
commit_date = convert_github_datetime(commit_date_str)
frappe.log_error(f'Branch: {branch_name}, Date: {commit_date}', 'GitHub Sync Debug')
repo_doc.append('branches_table', {
'repo_full_name': repo_full,
'branch_name': b.get('name'),
'commit_sha': b.get('commit', {}).get('sha'),
'protected': b.get('protected', False),
'last_updated': commit_date
'last_updated': commit_date or ''
})

# Clear and update members
Expand Down
4 changes: 2 additions & 2 deletions erpnext_github_integration/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _handle_issues_event(data, repo_full_name):
doc.state = issue.get('state', 'open')
doc.labels = ','.join([l.get('name', '') for l in issue.get('labels', [])])
doc.url = issue.get('html_url', '')
doc.updated_at = frappe.utils.get_datetime(issue.get('updated_at'))
doc.updated_at = convert_github_datetime(issue.get('updated_at'))

# Clear and update assignees
doc.set('assignees_table', [])
Expand Down Expand Up @@ -227,7 +227,7 @@ def _handle_pull_request_event(data, repo_full_name):
doc.author = pr.get('user', {}).get('login', '')
doc.mergeable_state = pr.get('mergeable_state', '')
doc.url = pr.get('html_url', '')
doc.updated_at = frappe.utils.get_datetime(pr.get('updated_at'))
doc.updated_at = convert_github_datetime(pr.get('updated_at'))

# Clear and update reviewers
doc.set('reviewers_table', [])
Expand Down
Loading