From 563f0e4f465944e6c1cab5b6fa25c7caad157c91 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Thu, 1 Jan 2026 22:04:57 +0000 Subject: [PATCH] fix: Standardize RunOnLinuxOnly attribute usage in build modules (#1528) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed inconsistent attribute naming where ChangedFilesInPullRequestModule used [RunOnLinux] while all other build modules used [RunOnLinuxOnly]. Since the module should only run on Linux (mandatory condition), updated to use RunOnLinuxOnly for consistency and correct semantics. Also updated documentation to clarify the difference between: - RunOn{OS} (OR logic - any matching condition allows run) - RunOn{OS}Only (AND/mandatory logic - condition must be met) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- docs/docs/how-to/run-conditions.md | 12 ++++++++++++ .../Modules/ChangedFilesInPullRequestModule.cs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/docs/how-to/run-conditions.md b/docs/docs/how-to/run-conditions.md index 52fd80b8df..561f15c02a 100644 --- a/docs/docs/how-to/run-conditions.md +++ b/docs/docs/how-to/run-conditions.md @@ -44,6 +44,18 @@ The above module will run on either Linux, or Mac. But not windows. Mandatory run conditions are similar to standard run conditions, but they MUST return true to run the module. If ANY return false, then the module will not run. +For built-in OS conditions, use the `*Only` variants for mandatory behavior: +- `[RunOnLinuxOnly]` - Module runs ONLY on Linux +- `[RunOnWindowsOnly]` - Module runs ONLY on Windows +- `[RunOnMacOSOnly]` - Module runs ONLY on macOS + +```csharp +[RunOnLinuxOnly] +public class MyLinuxOnlyModule : Module +``` + +The above module will ONLY run on Linux and will be skipped on Windows and macOS. + You can create your own custom mandatory run conditions by inheriting from `MandatoryRunConditionAttribute` and plugging custom logic into the `Condition` method. ```csharp diff --git a/src/ModularPipelines.Build/Modules/ChangedFilesInPullRequestModule.cs b/src/ModularPipelines.Build/Modules/ChangedFilesInPullRequestModule.cs index 9b78513eb6..84c439d03b 100644 --- a/src/ModularPipelines.Build/Modules/ChangedFilesInPullRequestModule.cs +++ b/src/ModularPipelines.Build/Modules/ChangedFilesInPullRequestModule.cs @@ -8,7 +8,7 @@ namespace ModularPipelines.Build.Modules; -[RunOnLinux] +[RunOnLinuxOnly] [SkipOnMainBranch] public class ChangedFilesInPullRequestModule : Module> {