1818 . Where ( o => null != o )
1919 . ToArray ( ) ;
2020
21- var client = new GitHubClient ( new ProductHeaderValue ( "nullinside" ) ) {
22- Credentials = new Credentials ( Environment . GetEnvironmentVariable ( "GITHUB_PAT" ) )
23- } ;
24-
25- var graphQl = new Connection ( new Octokit . GraphQL . ProductHeaderValue ( "nullinside" ) ,
26- Environment . GetEnvironmentVariable ( "GITHUB_PAT" ) ) ;
27-
28- ID projectId = await graphQl . Run ( new Query ( )
29- . Organization ( Constants . GITHUB_ORG )
30- . ProjectV2 ( Constants . GITHUB_PROJECT_NUM )
31- . Select ( p => p . Id ) ) ;
32-
33- IReadOnlyList < Repository > ? repository = await client . Repository . GetAllForOrg ( Constants . GITHUB_ORG ) ;
34- foreach ( Repository repo in repository ) {
35- if ( repo . Private ) {
36- continue ;
37- }
38-
39- foreach ( IRepoRule ? rule in rules ) {
40- await rule . Handle ( client , graphQl , projectId , repo ) ;
21+ while ( true ) {
22+ var client = new GitHubClient ( new ProductHeaderValue ( "nullinside" ) ) {
23+ Credentials = new Credentials ( Environment . GetEnvironmentVariable ( "GITHUB_PAT" ) )
24+ } ;
25+
26+ var graphQl = new Connection ( new Octokit . GraphQL . ProductHeaderValue ( "nullinside" ) ,
27+ Environment . GetEnvironmentVariable ( "GITHUB_PAT" ) ) ;
28+
29+ ID projectId = await graphQl . Run ( new Query ( )
30+ . Organization ( Constants . GITHUB_ORG )
31+ . ProjectV2 ( Constants . GITHUB_PROJECT_NUM )
32+ . Select ( p => p . Id ) ) ;
33+
34+ IReadOnlyList < Repository > ? repository = await client . Repository . GetAllForOrg ( Constants . GITHUB_ORG ) ;
35+ foreach ( Repository repo in repository ) {
36+ if ( repo . Private ) {
37+ continue ;
38+ }
39+
40+ foreach ( IRepoRule ? rule in rules ) {
41+ await rule ! . Handle ( client , graphQl , projectId , repo ) ;
42+ }
4143 }
44+
45+ Console . WriteLine ( "Waiting for next execution time..." ) ;
46+ Task . WaitAll ( Task . Delay ( TimeSpan . FromMinutes ( 5 ) ) ) ;
4247}
0 commit comments