@@ -89,6 +89,53 @@ public static AzureDevOpsBuild AzureDevOpsBuildUsingAzurePipelinesOAuthToken(
89
89
return AzureDevOpsBuild ( context , settings ) ;
90
90
}
91
91
92
+ /// <summary>
93
+ /// Returns if the Azure DevOps build is failing.
94
+ /// </summary>
95
+ /// <param name="context">The context.</param>
96
+ /// <param name="settings">Settings for getting the build.</param>
97
+ /// <example>
98
+ /// <para>Get changes associated with an Azure Pipelines build:</para>
99
+ /// <code>
100
+ /// <![CDATA[
101
+ /// var buildSettings =
102
+ /// new AzureDevOpsBuildSettings(
103
+ /// new Uri("http://myserver:8080/defaultcollection"),
104
+ /// "MyProject",
105
+ /// 42,
106
+ /// AzureDevOpsAuthenticationNtlm());
107
+ ///
108
+ /// var isFailing =
109
+ /// AzureDevOpsBuildIsFailing(
110
+ /// buildSettings);
111
+ ///
112
+ /// if (isFailing)
113
+ /// {
114
+ /// Information("Build is failing");
115
+ /// }
116
+ /// ]]>
117
+ /// </code>
118
+ /// </example>
119
+ /// <returns>The changes associated with the build.
120
+ /// Returns an empty list if build could not be found and
121
+ /// <see cref="AzureDevOpsBuildSettings.ThrowExceptionIfBuildCouldNotBeFound"/> is set to <c>false</c>.</returns>
122
+ /// <exception cref="AzureDevOpsBuildNotFoundException">If build could not be found and
123
+ /// <see cref="AzureDevOpsBuildSettings.ThrowExceptionIfBuildCouldNotBeFound"/> is set to <c>true</c>.</exception>
124
+ [ CakeMethodAlias ]
125
+ [ CakeAliasCategory ( "Azure Pipelines" ) ]
126
+ [ CakeNamespaceImport ( "Cake.AzureDevOps.Pipelines" ) ]
127
+ public static bool AzureDevOpsBuildIsFailing (
128
+ this ICakeContext context ,
129
+ AzureDevOpsBuildSettings settings )
130
+ {
131
+ context . NotNull ( nameof ( context ) ) ;
132
+ settings . NotNull ( nameof ( settings ) ) ;
133
+
134
+ return
135
+ new AzureDevOpsBuild ( context . Log , settings , new BuildClientFactory ( ) )
136
+ . IsBuildFailing ( ) ;
137
+ }
138
+
92
139
/// <summary>
93
140
/// Gets the changes associated with an Azure Pipelines build.
94
141
/// </summary>
0 commit comments