-
-
Notifications
You must be signed in to change notification settings - Fork 19
781 lines (695 loc) · 31.3 KB
/
generate-cli-options.yml
File metadata and controls
781 lines (695 loc) · 31.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
name: Generate CLI Options
on:
schedule:
# Run every Sunday at 2:00 AM UTC
- cron: '0 2 * * 0'
workflow_dispatch:
inputs:
# Specify which tools to run (comma-separated). Leave empty to run all tools.
# Linux tools: helm, kubectl, kustomize, docker, trivy, hadolint, podman, buildah, skopeo
# Cloud CLIs: az, gcloud, aws
# Infrastructure: terraform, pulumi, packer, vault, ansible, flyway, liquibase
# Development: dotnet, go, cargo, mvn, gradle, yarn, pnpm, gh
# Kubernetes/GitOps: eksctl, argocd, flux, kind, minikube
# Security/Quality: sonar-scanner, snyk, shellcheck, cosign, syft, grype
# Other: newman, jq, yq, pip
# Windows-only: choco, winget
tools:
description: 'Tools to run (comma-separated, empty = all). Example: helm,kubectl,docker'
required: false
default: ''
type: string
create-pr:
description: 'Create a pull request with changes'
required: false
default: true
type: boolean
jobs:
# Generate options for each tool in parallel (Linux)
generate:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
strategy:
fail-fast: false
matrix:
tool:
# Kubernetes/Container ecosystem
- helm
- kubectl
- kustomize
- docker
- trivy
- hadolint
- podman
- buildah
- skopeo
# Cloud CLIs
- az
- gcloud
- aws
# Infrastructure/DevOps
- terraform
- pulumi
- packer
- vault
- ansible
- flyway
- liquibase
# Development tools
- dotnet
- go
- cargo
- mvn
- gradle
# Node.js ecosystem
- yarn
- pnpm
# GitHub CLI
- gh
# Kubernetes/GitOps
- eksctl
- argocd
- flux
- kind
- minikube
# Code quality/Security
- sonar-scanner
- snyk
- shellcheck
# Supply chain security
- cosign
- syft
- grype
# Testing
- newman
# Data processing
- jq
- yq
# Python
- pip
steps:
- name: Check if tool should run
id: should-run
run: |
# For scheduled runs, all tools run. For manual runs, check the tools input.
if [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
else
# Get the tools input (comma-separated list, empty = all)
TOOLS_INPUT="${{ github.event.inputs.tools }}"
if [[ -z "$TOOLS_INPUT" ]]; then
# Empty input means run all tools
echo "run=true" >> $GITHUB_OUTPUT
else
# Check if this tool is in the comma-separated list
if echo ",$TOOLS_INPUT," | grep -q ",${{ matrix.tool }},"; then
echo "run=true" >> $GITHUB_OUTPUT
else
echo "run=false" >> $GITHUB_OUTPUT
fi
fi
fi
- name: Checkout
if: steps.should-run.outputs.run == 'true'
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
if: steps.should-run.outputs.run == 'true'
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Cache NuGet
if: steps.should-run.outputs.run == 'true'
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
# Clean up legacy manual files before generation
# Only delete specific service interface/implementation files that will be replaced
- name: Clean up legacy files
if: steps.should-run.outputs.run == 'true'
run: |
# Map tool to package directory and namespace prefix
declare -A TOOL_MAP=(
# Kubernetes/Container ecosystem
["helm"]="ModularPipelines.Helm:Helm"
["kubectl"]="ModularPipelines.Kubernetes:Kubernetes"
["kustomize"]="ModularPipelines.Kubernetes:Kustomize"
["docker"]="ModularPipelines.Docker:Docker"
["trivy"]="ModularPipelines.Trivy:Trivy"
["hadolint"]="ModularPipelines.Hadolint:Hadolint"
["podman"]="ModularPipelines.Podman:Podman"
["buildah"]="ModularPipelines.Buildah:Buildah"
["skopeo"]="ModularPipelines.Skopeo:Skopeo"
# Cloud CLIs
["az"]="ModularPipelines.Azure:Az"
["gcloud"]="ModularPipelines.Google:Gcloud"
["aws"]="ModularPipelines.AmazonWebServices:Aws"
# Infrastructure/DevOps
["terraform"]="ModularPipelines.Terraform:Terraform"
["pulumi"]="ModularPipelines.Pulumi:Pulumi"
["packer"]="ModularPipelines.Packer:Packer"
["vault"]="ModularPipelines.Vault:Vault"
["ansible"]="ModularPipelines.Ansible:Ansible"
["flyway"]="ModularPipelines.Flyway:Flyway"
["liquibase"]="ModularPipelines.Liquibase:Liquibase"
# Development tools
["dotnet"]="ModularPipelines.DotNet:DotNet"
["go"]="ModularPipelines.Go:Go"
["cargo"]="ModularPipelines.Rust:Cargo"
["mvn"]="ModularPipelines.Java:Maven"
["gradle"]="ModularPipelines.Java:Gradle"
# Node.js ecosystem
["yarn"]="ModularPipelines.Yarn:Yarn"
["pnpm"]="ModularPipelines.Node:Pnpm"
# GitHub CLI
["gh"]="ModularPipelines.GitHub:Gh"
# Kubernetes/GitOps
["eksctl"]="ModularPipelines.Eksctl:Eksctl"
["argocd"]="ModularPipelines.ArgoCd:ArgoCd"
["flux"]="ModularPipelines.Flux:Flux"
["kind"]="ModularPipelines.Kind:Kind"
["minikube"]="ModularPipelines.Minikube:Minikube"
# Code quality/Security
["sonar-scanner"]="ModularPipelines.SonarScanner:SonarScanner"
["snyk"]="ModularPipelines.Snyk:Snyk"
["shellcheck"]="ModularPipelines.Shellcheck:Shellcheck"
# Supply chain security
["cosign"]="ModularPipelines.Cosign:Cosign"
["syft"]="ModularPipelines.Syft:Syft"
["grype"]="ModularPipelines.Grype:Grype"
# Testing
["newman"]="ModularPipelines.Newman:Newman"
# Data processing
["jq"]="ModularPipelines.Jq:Jq"
["yq"]="ModularPipelines.Yq:Yq"
# Python
["pip"]="ModularPipelines.Python:Pip"
)
IFS=':' read -r PACKAGE PREFIX <<< "${TOOL_MAP[${{ matrix.tool }}]}"
if [ -n "$PACKAGE" ]; then
PKG_DIR="src/$PACKAGE"
if [ -d "$PKG_DIR" ]; then
echo "Cleaning up legacy files in $PKG_DIR for prefix $PREFIX..."
# Only delete specific service interface/implementation files (not all I*.cs files)
# These are the exact files the generator will create in Services/
rm -f "$PKG_DIR/I${PREFIX}.cs" 2>/dev/null || true
rm -f "$PKG_DIR/${PREFIX}.cs" 2>/dev/null || true
# Delete old .Generated.cs files in Services folder (will be replaced with non-.Generated names)
find "$PKG_DIR/Services" -name "*.Generated.cs" -type f -delete 2>/dev/null || true
echo "Cleanup complete for $PACKAGE"
fi
fi
# Install CLI tools needed for CLI-first scraping
- name: Install Helm
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'helm'
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Install kubectl
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'kubectl'
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Install Azure CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'az'
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Install Google Cloud CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'gcloud'
run: |
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install -y google-cloud-cli
- name: Install Terraform
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'terraform'
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install -y terraform
- name: Install Yarn
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'yarn'
run: |
corepack enable
corepack prepare yarn@stable --activate
# Create a minimal project context for Yarn Berry (required for help output)
mkdir -p /tmp/yarn-context && cd /tmp/yarn-context
echo '{"name":"temp","packageManager":"yarn@4.0.0"}' > package.json
# Verify yarn works in the project context
yarn --version
env:
# Set default Yarn context for subsequent commands
YARN_IGNORE_CWD: "true"
- name: Install AWS CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'aws'
run: |
# AWS CLI may be pre-installed on ubuntu-latest, use --update flag
# Install in /tmp to avoid committing installation files
cd /tmp
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install --update
cd -
- name: Install Kustomize
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'kustomize'
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
- name: Install Trivy
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'trivy'
run: |
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install -y trivy
- name: Install Hadolint
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'hadolint'
run: |
wget -O hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
chmod +x hadolint
sudo mv hadolint /usr/local/bin/
- name: Install Flyway
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'flyway'
run: |
wget -qO- https://download.red-gate.com/maven/release/com/redgate/flyway/flyway-commandline/10.20.1/flyway-commandline-10.20.1-linux-x64.tar.gz | tar xvz
sudo ln -s "$(pwd)/flyway-10.20.1/flyway" /usr/local/bin/flyway
- name: Install Go
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'go'
uses: actions/setup-go@v6
with:
go-version: 'stable'
- name: Install Maven
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'mvn'
run: |
sudo apt-get update
sudo apt-get install -y maven
- name: Install Gradle
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'gradle'
uses: gradle/actions/setup-gradle@v6
- name: Install pnpm
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'pnpm'
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install GitHub CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'gh'
run: |
# GitHub CLI is pre-installed on ubuntu-latest
gh --version
- name: Install SonarScanner
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'sonar-scanner'
run: |
wget -qO- https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip -O sonar-scanner.zip
unzip -q sonar-scanner.zip
sudo mv sonar-scanner-6.2.1.4610-linux-x64 /opt/sonar-scanner
sudo ln -s /opt/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner
- name: Install Snyk
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'snyk'
run: |
npm install -g snyk
- name: Install jq
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'jq'
run: |
# jq is pre-installed on ubuntu-latest
jq --version
- name: Install yq
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'yq'
run: |
wget -qO /tmp/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
chmod +x /tmp/yq
sudo mv /tmp/yq /usr/local/bin/yq
# Container tools (Docker alternatives)
- name: Install Podman
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'podman'
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Install Buildah
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'buildah'
run: |
sudo apt-get update
sudo apt-get install -y buildah
- name: Install Skopeo
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'skopeo'
run: |
sudo apt-get update
sudo apt-get install -y skopeo
# Infrastructure as Code tools
- name: Install Pulumi
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'pulumi'
run: |
curl -fsSL https://get.pulumi.com | sh
echo "$HOME/.pulumi/bin" >> $GITHUB_PATH
- name: Install Packer
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'packer'
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install -y packer
- name: Install Vault
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'vault'
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install -y vault
- name: Install Ansible
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'ansible'
run: |
sudo apt-get update
sudo apt-get install -y ansible
- name: Install Liquibase
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'liquibase'
run: |
# Use latest version - the tarball may extract directly or into a versioned directory
LIQUIBASE_VERSION="4.30.0"
mkdir -p /tmp/liquibase
wget -qO- "https://github.com/liquibase/liquibase/releases/download/v${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}.tar.gz" | tar xvz -C /tmp/liquibase
# Find the liquibase executable (could be directly in /tmp/liquibase or in a subdirectory)
LIQUIBASE_BIN=$(find /tmp/liquibase -name "liquibase" -type f -executable 2>/dev/null | head -1)
if [ -z "$LIQUIBASE_BIN" ]; then
# Try without executable check (might need chmod)
LIQUIBASE_BIN=$(find /tmp/liquibase -name "liquibase" -type f 2>/dev/null | head -1)
if [ -n "$LIQUIBASE_BIN" ]; then
chmod +x "$LIQUIBASE_BIN"
fi
fi
if [ -z "$LIQUIBASE_BIN" ]; then
echo "Error: Could not find liquibase executable"
ls -laR /tmp/liquibase
exit 1
fi
echo "Found liquibase at: $LIQUIBASE_BIN"
sudo ln -sf "$LIQUIBASE_BIN" /usr/local/bin/liquibase
# Verify installation
liquibase --version
# Rust ecosystem
- name: Install Cargo
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'cargo'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# Kubernetes/GitOps tools
- name: Install eksctl
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'eksctl'
run: |
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
- name: Install ArgoCD CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'argocd'
run: |
curl -sSL -o /tmp/argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
chmod +x /tmp/argocd-linux-amd64
sudo mv /tmp/argocd-linux-amd64 /usr/local/bin/argocd
- name: Install Flux CLI
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'flux'
run: |
curl -s https://fluxcd.io/install.sh | sudo bash
# Local Kubernetes tools
- name: Install Kind
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'kind'
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Install Minikube
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'minikube'
run: |
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
# Supply chain security tools
- name: Install Cosign
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'cosign'
run: |
# Use -fL to fail on HTTP errors and follow redirects
curl -fLo cosign https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64
chmod +x cosign
sudo mv cosign /usr/local/bin/
# Verify installation
cosign version
- name: Install Syft
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'syft'
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Install Grype
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'grype'
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
# Code quality tools
- name: Install ShellCheck
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'shellcheck'
run: |
# ShellCheck is pre-installed on ubuntu-latest
shellcheck --version
# Testing tools
- name: Install Newman
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'newman'
run: |
npm install -g newman
# Docker is pre-installed on ubuntu-latest
# .NET CLI is installed via setup-dotnet
# pip is pre-installed with Python on ubuntu-latest
- name: Build Generator
if: steps.should-run.outputs.run == 'true'
run: dotnet build -c Release
working-directory: tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator
- name: Run Generator for ${{ matrix.tool }}
if: steps.should-run.outputs.run == 'true'
run: |
dotnet run -c Release -- \
--tools "${{ matrix.tool }}" \
--output-dir "${{ github.workspace }}"
working-directory: tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator
- name: Check for changes
if: steps.should-run.outputs.run == 'true'
id: changes
run: |
# Only stage .cs files in src/ directory - ignore any other generated artifacts
git add 'src/**/*.cs'
# Check for actual content changes (ignore whitespace-only changes)
if git diff --staged --quiet --ignore-all-space --ignore-blank-lines; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No meaningful changes detected for ${{ matrix.tool }}"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Changed files:"
git diff --staged --name-only
fi
- name: Build solution to verify changes
if: steps.should-run.outputs.run == 'true' && steps.changes.outputs.has_changes == 'true'
run: dotnet build ModularPipelines.sln -c Release
- name: Create Pull Request for ${{ matrix.tool }}
id: create-pr
if: steps.should-run.outputs.run == 'true' && steps.changes.outputs.has_changes == 'true' && (github.event.inputs.create-pr != 'false')
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.CLI_SCRAPER_PAT_TOKEN }}
commit-message: "chore: Update ${{ matrix.tool }} CLI options"
title: "[Automated] Update ${{ matrix.tool }} CLI Options"
body: |
## Summary
This PR contains automatically generated updates to **${{ matrix.tool }}** CLI options classes.
The generator scraped the latest CLI help output from the installed tool.
## Changes
- Updated options classes to reflect latest CLI documentation
- Added new commands if any were detected
- Updated option types and descriptions
## Verification
- [x] Solution builds successfully
---
🤖 Generated with ModularPipelines.OptionsGenerator
branch: automated/update-cli-options-${{ matrix.tool }}
base: main
delete-branch: true
labels: |
automated
dependencies
author: thomhurst <9139608+thomhurst@users.noreply.github.com>
committer: thomhurst <9139608+thomhurst@users.noreply.github.com>
- name: Enable auto-merge
if: steps.create-pr.outputs.pull-request-number
run: gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash
env:
GH_TOKEN: ${{ secrets.CLI_SCRAPER_PAT_TOKEN }}
# Generate options for Windows-only tools
generate-windows:
runs-on: windows-latest
permissions:
contents: write
pull-requests: write
strategy:
fail-fast: false
matrix:
tool:
- choco
- winget
steps:
- name: Check if tool should run
id: should-run
shell: pwsh
run: |
# For scheduled runs, all tools run. For manual runs, check the tools input.
if ("${{ github.event_name }}" -eq "schedule") {
"run=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
# Get the tools input (comma-separated list, empty = all)
$toolsInput = "${{ github.event.inputs.tools }}"
if ([string]::IsNullOrWhiteSpace($toolsInput)) {
# Empty input means run all tools
"run=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
# Check if this tool is in the comma-separated list
$toolsList = $toolsInput -split ',' | ForEach-Object { $_.Trim() }
if ($toolsList -contains "${{ matrix.tool }}") {
"run=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
"run=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
}
}
- name: Checkout
if: steps.should-run.outputs.run == 'true'
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
if: steps.should-run.outputs.run == 'true'
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Cache NuGet
if: steps.should-run.outputs.run == 'true'
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
# Clean up legacy manual files before generation
# Only delete specific service interface/implementation files that will be replaced
- name: Clean up legacy files
if: steps.should-run.outputs.run == 'true'
shell: pwsh
run: |
# Map tool to package directory and namespace prefix
$toolMap = @{
"choco" = @{ Package = "ModularPipelines.Chocolatey"; Prefix = "Choco" }
"winget" = @{ Package = "ModularPipelines.WinGet"; Prefix = "Winget" }
}
$toolInfo = $toolMap["${{ matrix.tool }}"]
if ($toolInfo) {
$package = $toolInfo.Package
$prefix = $toolInfo.Prefix
$pkgDir = "src/$package"
if (Test-Path $pkgDir) {
Write-Host "Cleaning up legacy files in $pkgDir for prefix $prefix..."
# Only delete specific service interface/implementation files (not all I*.cs files)
# These are the exact files the generator will create in Services/
$interfaceFile = Join-Path $pkgDir "I$prefix.cs"
$implFile = Join-Path $pkgDir "$prefix.cs"
if (Test-Path $interfaceFile) {
Remove-Item $interfaceFile -Force -ErrorAction SilentlyContinue
Write-Host "Removed $interfaceFile"
}
if (Test-Path $implFile) {
Remove-Item $implFile -Force -ErrorAction SilentlyContinue
Write-Host "Removed $implFile"
}
# Delete old .Generated.cs files in Services folder (will be replaced with non-.Generated names)
$servicesDir = Join-Path $pkgDir "Services"
if (Test-Path $servicesDir) {
Get-ChildItem -Path $servicesDir -Filter "*.Generated.cs" -File -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
}
Write-Host "Cleanup complete for $package"
}
}
- name: Install Chocolatey
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'choco'
shell: pwsh
run: |
# Chocolatey is pre-installed on windows-latest
choco --version
- name: Install WinGet
if: steps.should-run.outputs.run == 'true' && matrix.tool == 'winget'
shell: pwsh
run: |
# WinGet is pre-installed on windows-latest (Windows Server 2022)
winget --version
- name: Build Generator
if: steps.should-run.outputs.run == 'true'
run: dotnet build -c Release
working-directory: tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator
- name: Run Generator for ${{ matrix.tool }}
if: steps.should-run.outputs.run == 'true'
shell: pwsh
run: |
dotnet run -c Release -- `
--tools "${{ matrix.tool }}" `
--output-dir "${{ github.workspace }}"
working-directory: tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator
- name: Check for changes
if: steps.should-run.outputs.run == 'true'
id: changes
shell: pwsh
run: |
# Only stage .cs files in src/ directory - ignore any other generated artifacts
git add 'src/**/*.cs'
# Check for actual content changes (ignore whitespace-only changes)
git diff --staged --quiet --ignore-all-space --ignore-blank-lines
$hasChanges = $LASTEXITCODE -ne 0
if ($hasChanges) {
"has_changes=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Changed files:"
git diff --staged --name-only
} else {
"has_changes=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "No meaningful changes detected for ${{ matrix.tool }}"
}
- name: Build solution to verify changes
if: steps.should-run.outputs.run == 'true' && steps.changes.outputs.has_changes == 'true'
run: dotnet build ModularPipelines.sln -c Release
- name: Create Pull Request for ${{ matrix.tool }}
id: create-pr
if: steps.should-run.outputs.run == 'true' && steps.changes.outputs.has_changes == 'true' && (github.event.inputs.create-pr != 'false')
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.CLI_SCRAPER_PAT_TOKEN }}
commit-message: "chore: Update ${{ matrix.tool }} CLI options"
title: "[Automated] Update ${{ matrix.tool }} CLI Options"
body: |
## Summary
This PR contains automatically generated updates to **${{ matrix.tool }}** CLI options classes.
The generator scraped the latest CLI help output from the installed tool.
## Changes
- Updated options classes to reflect latest CLI documentation
- Added new commands if any were detected
- Updated option types and descriptions
## Verification
- [x] Solution builds successfully
---
🤖 Generated with ModularPipelines.OptionsGenerator
branch: automated/update-cli-options-${{ matrix.tool }}
base: main
delete-branch: true
labels: |
automated
dependencies
author: thomhurst <9139608+thomhurst@users.noreply.github.com>
committer: thomhurst <9139608+thomhurst@users.noreply.github.com>
- name: Enable auto-merge
if: steps.create-pr.outputs.pull-request-number
shell: pwsh
run: gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash
env:
GH_TOKEN: ${{ secrets.CLI_SCRAPER_PAT_TOKEN }}