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> {