github::ActivityMonitor method summarize_push_event (public)

 <instance of github::ActivityMonitor[i]> summarize_push_event ev

Defined in packages/xowiki/tcl/github-activity-monitor-procs.tcl

Fetch commit details and build a summary for PushEvents.

Parameters:
ev (required)
Returns:
dict with fields of push event

Testcases:
No testcase defined.
Source code:
set type [dict get $ev type]
if {$type ne "PushEvent"} {
    return ""
}

set repo_full [dict get $ev repo name]          ;# e.g. "openacs/openacs-core"
set ref       [dict get $ev payload ref]        ;# "refs/heads/main"
set branch    [lindex [split $ref "/"] end]
set head_sha  [dict get $ev payload head]
set created_at [dict get $ev created_at]
set actor_login [dict get $ev actor login]

if {$repo_full eq "" || $head_sha eq ""} {
    return ""
}

# Fetch commit details
set commit_body [:get "/repos/$repo_full/commits/$head_sha"]
set c          [::util::json2dict $commit_body]
set commit     [dict get $c commit]

set author_dict [dict get $commit author]
set author_name [dict get $author_dict name]
set commit_date [dict get $author_dict date]    ;# ISO8601 string

set message_full [dict get $commit message]
set title        [lindex [split $message_full "\n"] 0]

set stats        [dict get $c stats]
set additions    [dict get $stats additions]
set deletions    [dict get $stats deletions]
set files        [dict get $c files]
set files_changed [llength $files]

return [list  event_id      [dict get $ev id]  repo          $repo_full  branch        $branch  sha           [dict get $c sha]  author_name   $author_name  author_login  $actor_login  commit_date   $commit_date  created_at    $created_at  title         $title  url           [dict get $c html_url]  files_changed $files_changed  additions     $additions  deletions     $deletions  raw_payload   $commit_body  ]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: