Skip to content

Commit

Permalink
include commit message body if it's there
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Mar 15, 2009
1 parent 1575c5b commit 08b9334
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion github-growler.pl
Expand Up @@ -91,9 +91,11 @@ sub growl_feed {
$icon = $AppIcon;
$last = 1;
} else {
my $body = munge_update_body($stuff->{entry}->content->body);
$event = get_event_type($stuff->{entry}->title);
$title = $stuff->{user}{name};
$description = $stuff->{entry}->title;
$description = $stuff->{entry}->title;
$description .= ": $body" if $body;
$icon = "$stuff->{user}{avatar}";
}
Mac::Growl::PostNotification($AppName, $event, $title, $description, 0, 0, $icon);
Expand All @@ -102,6 +104,14 @@ sub growl_feed {
}
}

sub munge_update_body {
use Web::Scraper;
my $content = shift;
my $res = scraper { process "div.message", message => 'TEXT' }->scrape($content);
$res->{message} =~ s/^\s*[0-9a-f]{40}\s*//; # strip SHA1
return $res->{message};
}

sub get_event_type {
my $title = shift;

Expand Down

0 comments on commit 08b9334

Please sign in to comment.