diff options
author | Remi Collet <fedora@famillecollet.com> | 2017-03-28 11:01:59 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2017-03-28 11:01:59 +0200 |
commit | e9d30a06d100732d3413e529ba630367a5717a7d (patch) | |
tree | f1bf2f490a855dc704158f35f9635dbeb7c475b9 /git2rss | |
parent | 3f8343456e50d99ba8e940dab95c34cd50193006 (diff) |
improve RSS content (more info in description)
Diffstat (limited to 'git2rss')
-rwxr-xr-x | git2rss | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -33,16 +33,27 @@ if (file_exists(__DIR__ . '/git2rss.json')) { } // Current change -$log = exec("git log --pretty=format:%H,%at,%an,%s -1"); +exec('git log --format=fuller -1', $out); +$log = exec("git log --pretty=format:%H,%at,%cn,%an,%s -1"); $entry = [ 'repo' => substr(getcwd(), strlen(LOCAL)), 'head' => basename($_SERVER['argv'][1] ?? 'master'), + 'desc' => implode("\n", $out), ]; -list($entry['hash'], $entry['time'], $entry['author'], $entry['comment']) = explode(',', $log, 4); +$log = exec("git log --pretty=format:%H,%at,%cn,%an,%s -1"); +list( + $entry['hash'], + $entry['time'], + $entry['commiter'], + $entry['author'], + $entry['comment'] +) = explode(',', $log, 5); + if (substr($entry['repo'], -4) != '.git') { $entry['repo'] .= '.git'; } $short = substr($entry['hash'], 0, 7); +printf("Welcome %s\n", $entry['commiter']); echo "RSS new entry: ${entry['author']} pushed to ${entry['repo']} (${entry['head']},$short): ${entry['comment']}\n"; // 50 recent changes, and save @@ -56,15 +67,15 @@ file_put_contents(__DIR__ . '/git2rss.json', json_encode($histo, JSON_PRETTY_PRI $feed = new Feed(); $channel = new Channel(); $channel - ->title("Remi's RPM git repostiories") - ->description('Change') - ->url(REMOTE) - ->language('en-US') - ->copyright('Copyright 2005-2017, Remi Collet') - ->pubDate(time()) - ->lastBuildDate(time()) - ->ttl(60) - ->appendTo($feed); + ->title("Remi's RPM git repostiories") + ->description('Change') + ->url(REMOTE) + ->language('en-US') + ->copyright('Copyright 2005-2017, Remi Collet') + ->pubDate(time()) + ->lastBuildDate(time()) + ->ttl(60) + ->appendTo($feed); foreach ($histo as $entry) { $short = substr($entry['hash'], 0, 7); @@ -73,7 +84,7 @@ foreach ($histo as $entry) { $item = new Item(); $item ->title($msg) - ->description($msg) + ->description($entry['desc'] ?? $msg) ->url(REMOTE . "${entry['repo']}/commit/?id=${entry['hash']}") ->author($entry['author']) ->pubDate($entry['time']) |