Skip to content

Commit dd458f0

Browse files
committed
Implement on-demand version bump changes fetcher
- Adds triggered command `ver GITHUB_URL_TO_VERSION_BUMP_COMMIT` - Useful for release managers
1 parent f53e201 commit dd458f0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

bin/geth.p6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class Geth::Plugin::Info {
1414
"Source at https://github.com/perl6/geth "
1515
~ "To add repo, add an 'application/json' webhook on GitHub "
1616
~ "pointing it to http://geth.perl6.party/?chan=#perl6 and choose "
17-
~ "'Send me everything' for events to send";
17+
~ "'Send me everything' for events to send | use `ver URL to commit` "
18+
~ "to fetch version bump changes";
1819
}
1920
}
2021

lib/Geth/Plugin/GitHub.pm6

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,32 @@ unit class Geth::Plugin::GitHub is IRC::Client::Plugin;
44
use IRC::TextColor;
55
use Geth::Config;
66
use Geth::GitHub::Hooks;
7+
use Geth::GitHub::Hooks::Preprocessor;
8+
79
has $.host is required;
810
has $.port is required;
911

1012
constant &Δ = &irc-style-text;
1113
constant THROTTLE_LINES_UNTHROTTLED_MAX = 5;
1214
constant THROTTLE_SLEEP = 2;
1315
constant THROTTLE_COOLDOWN = 8;
16+
constant $NQP_API_URL = 'https://api.github.com/repos/perl6/nqp';
17+
constant $RAKUDO_API_URL = 'https://api.github.com/repos/rakudo/rakudo';
18+
constant $NQP_URL = 'https://github.com/perl6/nqp';
19+
constant $MOAR_URL = 'https://github.com/MoarVM/MoarVM';
20+
21+
method irc-to-me (
22+
$ where /^ 'ver' \s+ 'https://github.com/' <-[/]>+ '/'
23+
$<repo>=<-[/]>+ '/commit/' $<sha>=\S+ $/
24+
) {
25+
Geth::GitHub::Hooks::Preprocessor.new.fetch-version-bump: |(
26+
$<repo> eq 'rakudo'
27+
?? ("$RAKUDO_API_URL/commits/$<sha>", $NQP_URL)
28+
!! ("$NQP_API_URL/commits/$<sha>", $MOAR_URL)
29+
)
30+
andthen "version bump brought in these changes: $_"
31+
orelse "Failed to fetch version bump info because reasons";
32+
}
1433

1534
method irc-started {
1635
start react {

0 commit comments

Comments
 (0)