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

Last change on this file since 36443 was 36443, checked in by taylor.smock, 5 weeks ago

Add script function to find repos with failing or no CI

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