File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ var root = Directory . GetCurrentDirectory ( ) ;
2+ foreach ( var scripts in GetScripts ( root ) )
3+ {
4+ foreach ( var script in scripts )
5+ {
6+ CommandExecutor . ExecuteCommandAndOutput ( "dotnet-exec {script} --dry-run" ) . EnsureSuccessExitCode ( ) ;
7+ }
8+ }
9+
10+ IEnumerable < string [ ] > GetScripts ( string root )
11+ {
12+ foreach ( var dir in Directory . GetDirectories ( root ) )
13+ {
14+ yield return Directory . GetFiles ( dir , "*.cs" ) ;
15+
16+ foreach ( var scripts in GetScripts ( dir ) )
17+ {
18+ yield return scripts ;
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ dotnet tool update -g dotnet-execute
2+ export PATH=" $PATH :$HOME /.dotnet/tools"
3+ #
4+ dotnet-exec ./build.cs
Original file line number Diff line number Diff line change 1+ using System . Net . Http . Json ;
2+
3+ var messageTemplate = """
4+ The service {{$env SERVICENAME}} deploy with version {{$env IMAGENAME}}
5+ RepoUrl: {{$env BUILD_REPOSITORY_URI}}
6+ [Amazing]
7+ """ ;
8+ var message = await WeihanLi . Common . Template . TemplateEngine . CreateDefault ( )
9+ . RenderAsync ( messageTemplate ) ;
10+ Console . WriteLine ( message ) ;
11+
12+ var webhookUrl = Environment . GetEnvironmentVariable ( "DingBotWebhookUrl" ) ;
13+ if ( string . IsNullOrEmpty ( webhookUrl ) )
14+ {
15+ Console . WriteLine ( "WebhookUrl not found" ) ;
16+ return ;
17+ }
18+
19+ using var response = await HttpHelper . HttpClient . PostAsJsonAsync ( webhookUrl , new
20+ {
21+ msgtype = "text" ,
22+ text = new
23+ {
24+ content = message
25+ }
26+ } ) ;
27+ response . EnsureSuccessStatusCode ( ) ;
You can’t perform that action at this time.
0 commit comments