Skip to content

Commit 2b0f2dc

Browse files
committed
Merge branch 'release/3.0.2'
2 parents cba1d28 + 6deb559 commit 2b0f2dc

File tree

8 files changed

+366
-23
lines changed

8 files changed

+366
-23
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ install:
1111
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
1212
- ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
1313
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
14-
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.413 -InstallDir $env:DOTNET_INSTALL_DIR'
15-
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.401 -InstallDir $env:DOTNET_INSTALL_DIR'
14+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.415 -InstallDir $env:DOTNET_INSTALL_DIR'
15+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.402 -InstallDir $env:DOTNET_INSTALL_DIR'
1616
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
1717
- ps: dotnet --info
1818

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
4-
"github>cake-contrib/renovate-presets"
4+
"github>cake-contrib/renovate-presets:cake-recipe"
55
],
66
"packageRules": [
77
{

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
33
"allowPrerelease": true,
4-
"version": "7.0.401",
4+
"version": "7.0.402",
55
"rollForward": "latestFeature"
66
}
77
}

src/Cake.AzureDevOps.Tests/Repos/PullRequest/AzureDevOpsPullRequestSettingsTests.cs

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.

src/Cake.AzureDevOps/AzureDevOpsAliases.PullRequest.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOA
9797
/// Make sure the build has the 'Allow Scripts to access OAuth token' option enabled.
9898
/// </summary>
9999
/// <param name="context">The context.</param>
100-
/// <param name="throwExceptionIfPullRequestCouldNotBeFound">Value indicating whether an exception
101-
/// should be thrown if pull request could not be found.</param>
100+
/// <param name="throwException">Value indicating whether an exception
101+
/// should be thrown if not running in Azure Pipelines or pull request could not be found.</param>
102102
/// <example>
103103
/// <para>Get a pull request:</para>
104104
/// <code>
@@ -109,32 +109,33 @@ public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOA
109109
/// </code>
110110
/// </example>
111111
/// <returns>Description of the pull request.
112-
/// Returns <c>null</c> if pull request could not be found and
113-
/// <paramref name="throwExceptionIfPullRequestCouldNotBeFound"/> is set to <c>false</c>.</returns>
114-
/// <exception cref="InvalidOperationException">If build is not running in Azure Pipelines,
115-
/// build is not for a pull request or 'Allow Scripts to access OAuth token' option is not enabled
116-
/// on the build definition.</exception>
117-
/// <exception cref="AzureDevOpsPullRequestNotFoundException">If pull request could not be found and
118-
/// <paramref name="throwExceptionIfPullRequestCouldNotBeFound"/> is set to <c>true</c>.</exception>
112+
/// Returns <c>null</c> if pull request could not be found or if not running in an Azure Pipelines build and
113+
/// <paramref name="throwException"/> is set to <c>false</c>.</returns>
114+
/// <exception cref="InvalidOperationException">If <paramref name="throwException"/>
115+
/// is set to <c>true</c> and build is not running in Azure Pipelines, build is not for a pull request or
116+
/// 'Allow Scripts to access OAuth token' option is not enabled on the build definition.</exception>
117+
/// <exception cref="AzureDevOpsPullRequestNotFoundException">If
118+
/// <paramref name="throwException"/> is set to <c>true</c> and pull request
119+
/// could not be found.</exception>
119120
[CakeMethodAlias]
120121
[CakeAliasCategory("Pull Request")]
121122
[CakeNamespaceImport("Cake.AzureDevOps.Repos")]
122123
[CakeNamespaceImport("Cake.AzureDevOps.Repos.PullRequest")]
123124
[CakeNamespaceImport("Cake.AzureDevOps.Repos.PullRequest.CommentThread")]
124125
public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOAuthToken(
125126
this ICakeContext context,
126-
bool throwExceptionIfPullRequestCouldNotBeFound)
127+
bool throwException)
127128
{
128129
context.NotNull(nameof(context));
129130

130-
var settings = AzureDevOpsPullRequestSettings.UsingAzurePipelinesOAuthToken(throwExceptionIfPullRequestCouldNotBeFound);
131+
var settings = AzureDevOpsPullRequestSettings.UsingAzurePipelinesOAuthToken(throwException);
131132

132133
if (settings == null)
133134
{
134135
return null;
135136
}
136137

137-
settings.ThrowExceptionIfPullRequestCouldNotBeFound = throwExceptionIfPullRequestCouldNotBeFound;
138+
settings.ThrowExceptionIfPullRequestCouldNotBeFound = throwException;
138139

139140
return AzureDevOpsPullRequest(context, settings);
140141
}

src/Cake.AzureDevOps/Cake.AzureDevOps.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
<RepositoryType>git</RepositoryType>
2424
<RepositoryUrl>https://github.com/cake-contrib/Cake.AzureDevOps.git</RepositoryUrl>
25-
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.AzureDevOps/releases/tag/3.0.1</PackageReleaseNotes>
25+
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.AzureDevOps/releases/tag/3.0.2</PackageReleaseNotes>
2626
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
2727
<IncludeBuildOutput>false</IncludeBuildOutput>
2828
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>

src/Cake.AzureDevOps/Pipelines/AzureDevOpsArtifactResource.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ public class AzureDevOpsArtifactResource
1212
/// <summary>
1313
/// Gets the data of the resource.
1414
/// </summary>
15-
public string Data { get; internal set; }
15+
public string Data { get; init; }
1616

1717
/// <summary>
1818
/// Gets the download url of the resource.
1919
/// </summary>
20-
public string DownloadUrl { get; internal set; }
20+
public string DownloadUrl { get; init; }
2121

2222
/// <summary>
2323
/// Gets the type of the resource.
2424
/// </summary>
25-
public AzurePipelinesArtifactType Type { get; internal set; }
25+
public AzurePipelinesArtifactType Type { get; init; }
2626

2727
/// <summary>
2828
/// Gets the full http link to the resource.
2929
/// </summary>
30-
public string Url { get; internal set; }
30+
public string Url { get; init; }
3131

3232
/// <summary>
3333
/// Gets the properties for the resource.
3434
/// </summary>
35-
public Dictionary<string, string> Properties { get; internal set; }
35+
public Dictionary<string, string> Properties { get; init; }
3636
}
3737
}

src/Cake.AzureDevOps/Repos/PullRequest/AzureDevOpsPullRequestSettings.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,19 @@ public static AzureDevOpsPullRequestSettings UsingAzurePipelinesOAuthToken(bool
124124
return null;
125125
}
126126

127-
return new AzureDevOpsPullRequestSettings(new AzureDevOpsOAuthCredentials(accessToken));
127+
try
128+
{
129+
return new AzureDevOpsPullRequestSettings(new AzureDevOpsOAuthCredentials(accessToken));
130+
}
131+
catch (InvalidOperationException)
132+
{
133+
if (!throwExceptionIfVariablesDontExist)
134+
{
135+
return null;
136+
}
137+
138+
throw;
139+
}
128140
}
129141

130142
/// <summary>

0 commit comments

Comments
 (0)