Koha Test Wiki Canasta - March 2024
One of a series of test instances for migrating the Koha Wiki MediaWiki database.
For the current Koha Wiki, visit https://wiki.koha-community.org .MRenvoize/RMaintTrack.pl
Jump to navigation
Jump to search
#!/usr/bin/env perl
use 5.24.1;
use Mojo::File;
use Mojo::UserAgent;
use Git::Raw;
# todoist api key
my $api_key = 'your_todoist_key';
# ua
my $ua = Mojo::UserAgent->new;
# open repository
my $repo = Git::Raw::Repository->open('/home/reposync/kohaclone');
# ensure we are looking at master
$repo->checkout('master',{ checkout_strategy => { safe => 1}});
# create a new walker
my $log = $repo->walker;
# lookup last synced commit
my $file = Mojo::File->new('/home/reposync/last_sync_commit');
chomp(my $commit = $file->slurp);
# push commit range to walker
$log->push_range("$commit..HEAD");
# reverse walker
$log->sorting(['reverse']);
# print all commit messages
my $commitref;
while (my $commit = $log->next) {
my $summary = $commit->summary;
say $commit->id ." - ". $commit->summary;
if ($commit->summary =~ /Bug (\d+)/) {
my $bug_number = $1;
$summary .= " [(Bugzilla)](https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=".$bug_number.")";
}
$commitref = $commit->id;
$summary .= " [(Commit)](https://gitlab.com/mrenvoize/Koha/commit/".$commit->id.")";
my $task = {
content => $summary,
due_string => "next Monday",
due_lang => "en",
priority => 4,
project_id => 2187026049
};
my $tx = $ua->post('https://beta.todoist.com/API/v8/tasks' => { Authorization=> "Bearer $api_key" } => json => $task );
}
say "Todoist Synced";
$file->spurt($commitref) if $commitref;