@@ -31,21 +31,8 @@ method nqp-version-bump ($json) {
31
31
and . <modified >[0 ] eq ' tools/build/NQP_REVISION'
32
32
} or return ;
33
33
34
- given $ ! ua . get (" $ RAKUDO_API_URL /commits/$ commit <id>" ) {
35
- unless . is-success {
36
- say " Failed to fetch Rakudo commit via API: "
37
- ~ . status-line ~ . content;
38
- return ;
39
- }
40
-
41
- my $ patch = try {
42
- CATCH { say " Failed to decode API JSON: $!" ; return ; }
43
- from-json(. content)<files >[0 ]<patch >;
44
- };
45
-
46
- $ json <geth-meta ><ver-bump > = " $ NQP_URL /compare/"
47
- ~ $ patch . lines [1 ,2 ]». substr (1 ). join (' ...' );
48
- }
34
+ self . fetch-version-bump: " $ RAKUDO_API_URL /commits/$ commit <id>" , $ NQP_URL
35
+ andthen $ json <geth-meta ><ver-bump > = $ _ ;
49
36
}
50
37
51
38
method moar-version-bump ($ json ) {
@@ -54,9 +41,15 @@ method moar-version-bump ($json) {
54
41
and . <modified >[0 ] eq ' tools/build/MOAR_REVISION'
55
42
} or return ;
56
43
57
- given $ ! ua . get (" $ NQP_API_URL /commits/$ commit <id>" ) {
44
+ self . fetch-version-bump: " $ NQP_API_URL /commits/$ commit <id>" , $ MOAR_URL
45
+ andthen $ json <geth-meta ><ver-bump > = $ _ ;
46
+ }
47
+
48
+ method fetch-version-bump ($ commit-url , $ compare-url-part ) {
49
+ given $ ! ua . get ($ commit-url ) {
58
50
unless . is-success {
59
- say " Failed to fetch NQP commit via API: { . status-line ~ . content} " ;
51
+ say " Failed to fetch $ commit-url via API: "
52
+ ~ . status-line ~ . content;
60
53
return ;
61
54
}
62
55
@@ -65,7 +58,6 @@ method moar-version-bump ($json) {
65
58
from-json(. content)<files >[0 ]<patch >;
66
59
};
67
60
68
- $ json <geth-meta ><ver-bump > = " $ MOAR_URL /compare/"
69
- ~ $ patch . lines [1 ,2 ]». substr (1 ). join (' ...' );
61
+ " $ compare-url-part /compare/" ~ $ patch . lines [1 ,2 ]». substr (1 ). join (' ...' );
70
62
}
71
63
}
0 commit comments