source: osm/applications/editors/josm/plugins/github

Last change on this file was 36444, checked in by stoecker, 3 weeks ago

add help target

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use Cwd;
5
6open(my $file, '<', 'github_plugins') or die;
7
8if(($ARGV[0]||'') eq 'help')
9{
10 print
11 "broken show broken CI\n" .
12 "checkout checkout all repos\n" .
13 "i18nupdate send I18n updates (don't use without checking before)\n" .
14 "reset reset all changes\n" .
15 "status show current repository states\n" .
16 "\n" .
17 "<default> do pullrequests\n";
18}
19elsif(($ARGV[0]||'') eq 'checkout')
20{
21 for my $plugin (<$file>)
22 {
23 chomp($plugin);
24 system('git','clone',"https://github.com/JOSM/$plugin");
25 }
26}
27elsif(($ARGV[0]||'') eq 'status')
28{
29 my $dir = cwd();
30 for my $plugin (<$file>)
31 {
32 print($plugin);
33 chomp($plugin);
34 chdir($plugin);
35 system('git','status');
36 chdir($dir);
37 }
38}
39elsif(($ARGV[0]||'') eq 'reset')
40{
41 my $dir = cwd();
42 for my $plugin (<$file>)
43 {
44 print($plugin);
45 chomp($plugin);
46 chdir($plugin);
47 system('git','reset','--hard','HEAD');
48 system('git','pull');
49 chdir($dir);
50 }
51}
52elsif(($ARGV[0]||'') eq 'i18nupdate')
53{
54 my $dir = cwd();
55 for my $plugin (<$file>)
56 {
57 print($plugin);
58 chomp($plugin);
59 chdir($plugin);
60 my $p = Cwd::abs_path('data');
61 for my $file (glob "$p/*.lang")
62 {
63 system('git','add',$file);
64 system('git','add',$file);
65 }
66 system('git','commit','-m','I18n update');
67 system('git','remote','set-url','origin',"git\@github.com:JOSM/$plugin.git");
68 system('git','push');
69 chdir($dir);
70 }
71
72}
73elsif(($ARGV[0]||'') eq 'broken')
74{
75 my $dir = cwd();
76 my $branch = 'master';
77 for my $plugin (<$file>)
78 {
79 chomp($plugin);
80 chdir($plugin);
81 my $workflow = `gh run list --limit 1 --workflow 'Java CI' --branch $branch --json databaseId --jq '.[].databaseId'`;
82 chomp($workflow);
83 my $conclusion = 'not implemented';
84 if($workflow ne '')
85 {
86 $conclusion = `gh run view $workflow --json conclusion --jq .conclusion`;
87 chomp($conclusion);
88 }
89 if($conclusion ne 'success')
90 {
91 print($plugin . "\n");
92 }
93 chdir($dir);
94 }
95}
96else
97{
98 my $dir = cwd();
99 for my $plugin (<$file>)
100 {
101 print($plugin);
102 chomp($plugin);
103 chdir($plugin);
104 system('git','pull');
105 chdir($dir);
106 }
107}
108close($file);
Note: See TracBrowser for help on using the repository browser.