From b00c9f18527042a81fb1ee5c31059d3c7de9dd49 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:39:05 +0000 Subject: [PATCH 1/3] chore: Add .worktrees/ to .gitignore for parallel development MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 88f3ca33fc..6a72d69cea 100644 --- a/.gitignore +++ b/.gitignore @@ -399,4 +399,4 @@ FodyWeavers.xsd requirements .claude/settings.local.json -nul \ No newline at end of file +nul.worktrees/ From 414d9e2fd6d0ebfca5e2b3874031d5f1b354709c Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 30 Dec 2025 02:42:46 +0000 Subject: [PATCH 2/3] refactor: Extract NuGet upload logic to shared helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract duplicated NuGet package upload logic from UploadPackagesToNugetModule and UploadPackagesToLocalNuGetModule into a new NugetUploadHelper class. Fixes #1459 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../Helpers/NugetUploadHelper.cs | 28 +++++++++++++++++++ .../UploadPackagesToLocalNuGetModule.cs | 18 +++++------- .../Modules/UploadPackagesToNugetModule.cs | 19 +++++-------- 3 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 src/ModularPipelines.Build/Helpers/NugetUploadHelper.cs diff --git a/src/ModularPipelines.Build/Helpers/NugetUploadHelper.cs b/src/ModularPipelines.Build/Helpers/NugetUploadHelper.cs new file mode 100644 index 0000000000..8fd754f2f3 --- /dev/null +++ b/src/ModularPipelines.Build/Helpers/NugetUploadHelper.cs @@ -0,0 +1,28 @@ +using EnumerableAsyncProcessor.Extensions; +using ModularPipelines.Context; +using ModularPipelines.DotNet.Extensions; +using ModularPipelines.DotNet.Options; +using ModularPipelines.Models; +using File = ModularPipelines.FileSystem.File; + +namespace ModularPipelines.Build.Helpers; + +public static class NugetUploadHelper +{ + public static async Task UploadPackagesAsync( + IModuleContext context, + IEnumerable packagePaths, + string source, + string? apiKey, + CancellationToken cancellationToken) + { + return await packagePaths + .SelectAsync(async nugetFile => await context.DotNet().Nuget.Push(new DotNetNugetPushOptions + { + Path = nugetFile, + Source = source, + ApiKey = apiKey, + }, cancellationToken), cancellationToken: cancellationToken) + .ProcessOneAtATime(); + } +} diff --git a/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs b/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs index 077365923d..80b051324d 100644 --- a/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs +++ b/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs @@ -1,9 +1,6 @@ -using EnumerableAsyncProcessor.Extensions; -using Microsoft.Extensions.Logging; using ModularPipelines.Attributes; +using ModularPipelines.Build.Helpers; using ModularPipelines.Context; -using ModularPipelines.DotNet.Extensions; -using ModularPipelines.DotNet.Options; using ModularPipelines.Extensions; using ModularPipelines.FileSystem; using ModularPipelines.Models; @@ -23,12 +20,11 @@ public class UploadPackagesToLocalNuGetModule : Module var localRepoLocation = context.GetModule(); var packagePaths = context.GetModule>(); - return await packagePaths.Value! - .SelectAsync(async nugetFile => await context.DotNet().Nuget.Push(new DotNetNugetPushOptions - { - Path = nugetFile, - Source = localRepoLocation.Value.AssertExists(), - }, cancellationToken), cancellationToken: cancellationToken) - .ProcessOneAtATime(); + return await NugetUploadHelper.UploadPackagesAsync( + context, + packagePaths.Value!, + source: localRepoLocation.Value.AssertExists()!, + apiKey: null, + cancellationToken); } } \ No newline at end of file diff --git a/src/ModularPipelines.Build/Modules/UploadPackagesToNugetModule.cs b/src/ModularPipelines.Build/Modules/UploadPackagesToNugetModule.cs index 3b5caa0117..e701801152 100644 --- a/src/ModularPipelines.Build/Modules/UploadPackagesToNugetModule.cs +++ b/src/ModularPipelines.Build/Modules/UploadPackagesToNugetModule.cs @@ -1,11 +1,8 @@ -using EnumerableAsyncProcessor.Extensions; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using ModularPipelines.Attributes; +using ModularPipelines.Build.Helpers; using ModularPipelines.Build.Settings; using ModularPipelines.Context; -using ModularPipelines.DotNet.Extensions; -using ModularPipelines.DotNet.Options; using ModularPipelines.Git.Attributes; using ModularPipelines.GitHub.Attributes; using ModularPipelines.Models; @@ -43,13 +40,11 @@ public Task ShouldSkip(IPipelineContext context) var packagePaths = context.GetModule>(); - return await packagePaths.Value! - .SelectAsync(async nugetFile => await context.DotNet().Nuget.Push(new DotNetNugetPushOptions - { - Path = nugetFile, - Source = "https://api.nuget.org/v3/index.json", - ApiKey = _nugetSettings.Value.ApiKey!, - }, cancellationToken), cancellationToken: cancellationToken) - .ProcessOneAtATime(); + return await NugetUploadHelper.UploadPackagesAsync( + context, + packagePaths.Value!, + source: "https://api.nuget.org/v3/index.json", + apiKey: _nugetSettings.Value.ApiKey, + cancellationToken); } } \ No newline at end of file From 50d05a84169c35fbbafe705d7df52c791743e031 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 30 Dec 2025 10:16:08 +0000 Subject: [PATCH 3/3] fix: Address code review feedback - type mismatch and null check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix UploadPackagesToLocalNuGetModule.cs: Use .Path property on Folder object when passing to source parameter (fixes type mismatch) - UploadPackagesToNugetModule.cs already has the required null check for API key at line 39 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs b/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs index 80b051324d..197ec47680 100644 --- a/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs +++ b/src/ModularPipelines.Build/Modules/LocalMachine/UploadPackagesToLocalNuGetModule.cs @@ -23,7 +23,7 @@ public class UploadPackagesToLocalNuGetModule : Module return await NugetUploadHelper.UploadPackagesAsync( context, packagePaths.Value!, - source: localRepoLocation.Value.AssertExists()!, + source: localRepoLocation.Value.AssertExists()!.Path, apiKey: null, cancellationToken); }