-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
OSOE-385: verify-dotnet-consolidation action should not fail the installation if it's already installed
- Loading branch information
Showing
8 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Install .NET tool | ||
description: Installs a .NET tool globally. | ||
|
||
inputs: | ||
name: | ||
required: true | ||
description: The name of the tool to install. | ||
version: | ||
required: true | ||
description: The version of the tool to install. | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Scripts | ||
shell: pwsh | ||
run: | | ||
(Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH | ||
- name: Install tool | ||
shell: pwsh | ||
run: | | ||
Install-DotNetTool -Name "${{ inputs.name }}" -Version "${{ inputs.version }}" -Global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.github/actions/verify-submodule-pull-request/Check-Current.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
param([string] $Title) | ||
|
||
if (Check-PullRequestTitle $Title) { exit 0 } | ||
if (Confirm-PullRequestTitle $Title) { exit 0 } | ||
Set-Failed ('The pull request title is not in the expected format. Please start with the issue code followed by a ' + | ||
'colon and the title, e.g. "PROJ-123: My PR Title".') |
4 changes: 0 additions & 4 deletions
4
.github/actions/verify-submodule-pull-request/Check-PullRequestTitle.ps1
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 0)] | ||
[string] $Title | ||
) | ||
|
||
return $Title -match '^\s*\w+-\d+\s*:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 1, HelpMessage = "The name of the tool to install.")] | ||
[string] | ||
$Name, | ||
|
||
[Parameter(Mandatory = $true, Position = 2, HelpMessage = "The version of the tool to install.")] | ||
[string] | ||
$Version, | ||
|
||
[Parameter(HelpMessage = "When present, the tool will be installed globally, locally otherwise.")] | ||
[switch] | ||
$Global | ||
) | ||
|
||
$scopeString = "" | ||
if ($Global.IsPresent) | ||
{ | ||
$scopeString = "--global" | ||
} | ||
|
||
$installedTool = dotnet tool list $scopeString | Select-Object -Skip 2 | ForEach-Object { | ||
$segments = $_.Split(" ", [System.StringSplitOptions]::RemoveEmptyEntries) | ||
return New-Object -TypeName PSObject -Property @{ | ||
PackageId = $segments[0] | ||
Version = $segments[1] | ||
Commands = $segments[2] | ||
} | ||
} | Where-Object { $_.PackageId -eq $Name } | ||
|
||
$doInstall = $true | ||
|
||
if ($null -ne $installedTool -and $installedTool -ne "") | ||
{ | ||
if ($installedTool.Version -ne $Version) | ||
{ | ||
dotnet tool uninstall $Name $scopeString | ||
} | ||
else | ||
{ | ||
Write-Output "$Name version $Version is already installed!" | ||
$doInstall = $false | ||
} | ||
} | ||
|
||
if ($doInstall) | ||
{ | ||
dotnet tool install $Name --version $Version $scopeString | ||
} |