Skip to content

Commit

Permalink
Merge branch 'release/3.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Oct 11, 2023
2 parents cba1d28 + 6deb559 commit 2b0f2dc
Show file tree
Hide file tree
Showing 8 changed files with 366 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ install:
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
- ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.413 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.401 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.415 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.402 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
- ps: dotnet --info

Expand Down
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>cake-contrib/renovate-presets"
"github>cake-contrib/renovate-presets:cake-recipe"
],
"packageRules": [
{
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": true,
"version": "7.0.401",
"version": "7.0.402",
"rollForward": "latestFeature"
}
}

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions src/Cake.AzureDevOps/AzureDevOpsAliases.PullRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOA
/// Make sure the build has the 'Allow Scripts to access OAuth token' option enabled.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="throwExceptionIfPullRequestCouldNotBeFound">Value indicating whether an exception
/// should be thrown if pull request could not be found.</param>
/// <param name="throwException">Value indicating whether an exception
/// should be thrown if not running in Azure Pipelines or pull request could not be found.</param>
/// <example>
/// <para>Get a pull request:</para>
/// <code>
Expand All @@ -109,32 +109,33 @@ public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOA
/// </code>
/// </example>
/// <returns>Description of the pull request.
/// Returns <c>null</c> if pull request could not be found and
/// <paramref name="throwExceptionIfPullRequestCouldNotBeFound"/> is set to <c>false</c>.</returns>
/// <exception cref="InvalidOperationException">If build is not running in Azure Pipelines,
/// build is not for a pull request or 'Allow Scripts to access OAuth token' option is not enabled
/// on the build definition.</exception>
/// <exception cref="AzureDevOpsPullRequestNotFoundException">If pull request could not be found and
/// <paramref name="throwExceptionIfPullRequestCouldNotBeFound"/> is set to <c>true</c>.</exception>
/// Returns <c>null</c> if pull request could not be found or if not running in an Azure Pipelines build and
/// <paramref name="throwException"/> is set to <c>false</c>.</returns>
/// <exception cref="InvalidOperationException">If <paramref name="throwException"/>
/// is set to <c>true</c> and build is not running in Azure Pipelines, build is not for a pull request or
/// 'Allow Scripts to access OAuth token' option is not enabled on the build definition.</exception>
/// <exception cref="AzureDevOpsPullRequestNotFoundException">If
/// <paramref name="throwException"/> is set to <c>true</c> and pull request
/// could not be found.</exception>
[CakeMethodAlias]
[CakeAliasCategory("Pull Request")]
[CakeNamespaceImport("Cake.AzureDevOps.Repos")]
[CakeNamespaceImport("Cake.AzureDevOps.Repos.PullRequest")]
[CakeNamespaceImport("Cake.AzureDevOps.Repos.PullRequest.CommentThread")]
public static AzureDevOpsPullRequest AzureDevOpsPullRequestUsingAzurePipelinesOAuthToken(
this ICakeContext context,
bool throwExceptionIfPullRequestCouldNotBeFound)
bool throwException)
{
context.NotNull(nameof(context));

var settings = AzureDevOpsPullRequestSettings.UsingAzurePipelinesOAuthToken(throwExceptionIfPullRequestCouldNotBeFound);
var settings = AzureDevOpsPullRequestSettings.UsingAzurePipelinesOAuthToken(throwException);

if (settings == null)
{
return null;
}

settings.ThrowExceptionIfPullRequestCouldNotBeFound = throwExceptionIfPullRequestCouldNotBeFound;
settings.ThrowExceptionIfPullRequestCouldNotBeFound = throwException;

return AzureDevOpsPullRequest(context, settings);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.AzureDevOps/Cake.AzureDevOps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/cake-contrib/Cake.AzureDevOps.git</RepositoryUrl>
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.AzureDevOps/releases/tag/3.0.1</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.AzureDevOps/releases/tag/3.0.2</PackageReleaseNotes>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<IncludeBuildOutput>false</IncludeBuildOutput>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
Expand Down
10 changes: 5 additions & 5 deletions src/Cake.AzureDevOps/Pipelines/AzureDevOpsArtifactResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ public class AzureDevOpsArtifactResource
/// <summary>
/// Gets the data of the resource.
/// </summary>
public string Data { get; internal set; }
public string Data { get; init; }

/// <summary>
/// Gets the download url of the resource.
/// </summary>
public string DownloadUrl { get; internal set; }
public string DownloadUrl { get; init; }

/// <summary>
/// Gets the type of the resource.
/// </summary>
public AzurePipelinesArtifactType Type { get; internal set; }
public AzurePipelinesArtifactType Type { get; init; }

/// <summary>
/// Gets the full http link to the resource.
/// </summary>
public string Url { get; internal set; }
public string Url { get; init; }

/// <summary>
/// Gets the properties for the resource.
/// </summary>
public Dictionary<string, string> Properties { get; internal set; }
public Dictionary<string, string> Properties { get; init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,19 @@ public static AzureDevOpsPullRequestSettings UsingAzurePipelinesOAuthToken(bool
return null;
}

return new AzureDevOpsPullRequestSettings(new AzureDevOpsOAuthCredentials(accessToken));
try
{
return new AzureDevOpsPullRequestSettings(new AzureDevOpsOAuthCredentials(accessToken));
}
catch (InvalidOperationException)
{
if (!throwExceptionIfVariablesDontExist)
{
return null;
}

throw;
}
}

/// <summary>
Expand Down

0 comments on commit 2b0f2dc

Please sign in to comment.