From 5b29bfbecf9b31503763cac6f6f9325e7c6ac9c2 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Fri, 25 Nov 2022 15:42:42 +0100 Subject: [PATCH 01/20] Automatically fixing PS analyzer violations --- .../Initialize-IssueDetails.ps1 | 6 +++--- .github/actions/publish-nuget/New-NuGetPackage.ps1 | 2 +- .github/actions/test-dotnet/Invoke-SolutionTests.ps1 | 4 ++-- .github/actions/test-dotnet/Merge-FailureDumps.ps1 | 2 +- .../actions/verify-submodule-pull-request/Check-Parent.ps1 | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 index 60be840f5..162141e9f 100644 --- a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 +++ b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 @@ -1,4 +1,4 @@ -param +param ( $GitHub, $IssueComponent, @@ -8,8 +8,8 @@ param $PullReqestJiraIssueDescription ) -$context = [string]::IsNullOrEmpty($IssueComponent) ? $GitHub.repository : $IssueComponent -$titleSuffix = $SuffixIssueTitles ? " in $context" : "" +$context = [string]::IsNullOrEmpty($IssueComponent) Where-Object $GitHub.repository : $IssueComponent +$titleSuffix = $SuffixIssueTitles Where-Object " in $context" : "" Write-Output "Suffix: $titleSuffix" switch ($GitHub.event_name) diff --git a/.github/actions/publish-nuget/New-NuGetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 index 5deb7084a..e2f2487ee 100644 --- a/.github/actions/publish-nuget/New-NuGetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -16,7 +16,7 @@ param([array] $Arguments) -$projects = (Test-Path *.sln) ? (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) +$projects = (Test-Path *.sln) Where-Object (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) foreach ($project in $projects) { diff --git a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 index 3bf699026..2975f6836 100644 --- a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 +++ b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 @@ -55,8 +55,8 @@ foreach ($test in $tests) { # This is for xUnit ITestOutputHelper, see https://xunit.net/docs/capturing-output. '--logger', 'console;verbosity=detailed' '--verbosity', $Verbosity - $Filter ? '--filter' : '' - $Filter ? $Filter : '' + $Filter Where-Object '--filter' : '' + $Filter Where-Object $Filter : '' $test ) diff --git a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 index 69aa2a6e6..56a3cc9ef 100644 --- a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 +++ b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 @@ -3,7 +3,7 @@ New-Item -Type Directory "$Directory/FailureDumps" $testDirectory = "$Directory/test" -$rootDirectory = (Test-Path -Path $testDirectory) ? $testDirectory : $Directory +$rootDirectory = (Test-Path -Path $testDirectory) Where-Object $testDirectory : $Directory Get-ChildItem $rootDirectory -Recurse | Where-Object { $PSItem.Name -eq 'FailureDumps' } | diff --git a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 index 7ce8f300e..2245640e4 100644 --- a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 +++ b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 @@ -4,7 +4,7 @@ ) $url = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100" -$titles = curl -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $PSItem.title } +$titles = Invoke-WebRequest -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $PSItem.title } $Branch -match '(\w+-\d+)' $issueCode = $matches[0] From b500235d56c882b8308f449032bbca30517f8b96 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Fri, 25 Nov 2022 15:53:59 +0100 Subject: [PATCH 02/20] Windows PowerShell compatibility fixes and automatic styling fixes by VS Code --- .../Build-DotNetSolutionOrProject.ps1 | 5 +++-- .../build-dotnet/Write-CacheConfiguration.ps1 | 2 +- .../Initialize-IssueDetails.ps1 | 6 +++--- .../Initialize-IssueTemplates.ps1 | 2 +- .../actions/publish-nuget/New-NuGetPackage.ps1 | 2 +- .../publish-nuget/Update-ManifestVersion.ps1 | 3 ++- .../setup-sql-server/Initialize-SqlServer.ps1 | 4 ++-- .../test-dotnet/Invoke-SolutionTests.ps1 | 11 ++++++----- .../actions/test-dotnet/Merge-FailureDumps.ps1 | 2 +- .../Set-XUnitMaxParallelThreads.ps1 | 18 +++++++++--------- 10 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 b/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 index a6edf7783..014577c90 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 @@ -51,7 +51,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution or project with the Lombiq.Analyzers files. The output and exit code are discarded because # they will be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and # the target will still run on the projects that have it. -dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $SolutionOrProject | Out-Null || bash -c 'true' +dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $SolutionOrProject | Out-Null -or bash -c 'true' Write-Output "Building solution or project with ``dotnet build $SolutionOrProject $($buildSwitches -join " ")``." @@ -112,7 +112,8 @@ if ($expectedErrorCodes) } } - if ($fail -gt 0) { + if ($fail -gt 0) + { Write-Warning $report.ToString() # We use warning so it doesn't stop prematurely. Write-Output ("::error::Verification Mismatch " + ($errorLines -join " ")) exit 1 diff --git a/.github/actions/build-dotnet/Write-CacheConfiguration.ps1 b/.github/actions/build-dotnet/Write-CacheConfiguration.ps1 index 7eea413b7..cc9e67c40 100644 --- a/.github/actions/build-dotnet/Write-CacheConfiguration.ps1 +++ b/.github/actions/build-dotnet/Write-CacheConfiguration.ps1 @@ -4,7 +4,7 @@ function Invoke-Maybe($Block) { try { Invoke-Command -ScriptBlock $Block } catch $paths = @() -if ($IsNuget) { $paths += ,'~/.nuget/packages' } +if ($IsNuget) { $paths += , '~/.nuget/packages' } if ($IsNpm) { diff --git a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 index 162141e9f..2b9533a86 100644 --- a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 +++ b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 @@ -8,8 +8,8 @@ $PullReqestJiraIssueDescription ) -$context = [string]::IsNullOrEmpty($IssueComponent) Where-Object $GitHub.repository : $IssueComponent -$titleSuffix = $SuffixIssueTitles Where-Object " in $context" : "" +$context = [string]::IsNullOrEmpty($IssueComponent) | Where-Object $GitHub.repository : $IssueComponent +$titleSuffix = $SuffixIssueTitles | Where-Object " in $context" : "" Write-Output "Suffix: $titleSuffix" switch ($GitHub.event_name) @@ -54,7 +54,7 @@ switch ($GitHub.event_name) default { $message = "Unknown event `"$($GitHub.event_name)`". Please only call this script for one of the following " + - "events: discussion, issues, pull_request." + "events: discussion, issues, pull_request." Write-Error "::error::$message" exit 1 } diff --git a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueTemplates.ps1 b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueTemplates.ps1 index 948d3ff8b..8ebb444eb 100644 --- a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueTemplates.ps1 +++ b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueTemplates.ps1 @@ -2,7 +2,7 @@ if ([string]::IsNullOrEmpty($Env:DISCUSSION_JIRA_ISSUE_DESCRIPTION)) { - $templates["DISCUSSION_JIRA_ISSUE_DESCRIPTION"] = @" + $templates["DISCUSSION_JIRA_ISSUE_DESCRIPTION"] = @" h1. Summary See the linked GitHub discussion, including all the comments. Please do all communication there, unless it's confidential or administrative. diff --git a/.github/actions/publish-nuget/New-NuGetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 index e2f2487ee..3372060b2 100644 --- a/.github/actions/publish-nuget/New-NuGetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -16,7 +16,7 @@ param([array] $Arguments) -$projects = (Test-Path *.sln) Where-Object (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) +$projects = (Test-Path *.sln) | Where-Object (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) foreach ($project in $projects) { diff --git a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 index 61404357d..cdd827e29 100644 --- a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 +++ b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 @@ -9,7 +9,8 @@ $manifests = Get-ChildItem $WorkDir -File -Recurse -Filter "Manifest.cs" | Select-String -List -Pattern '(OrchardCore.Modules.Manifest|OrchardCore.DisplayManagement.Manifest)' | Select-Object -ExpandProperty Path -foreach ($manifest in $manifests) { +foreach ($manifest in $manifests) +{ $regex = '(?\[assembly:\s*(Module|Theme)\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$PackageVersion" (Get-Content -Raw $manifest) -replace $regex | Out-File $manifest diff --git a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 index 547a89c50..cba305f96 100644 --- a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 +++ b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 @@ -12,7 +12,7 @@ else '--detach', 'mcr.microsoft.com/mssql/server:2019-latest' ) - docker pull mcr.microsoft.com/mssql/server && - docker run @dockerRunSwitches && + docker pull mcr.microsoft.com/mssql/server + docker run @dockerRunSwitches docker exec --user 0 sql2019 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' } diff --git a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 index 2975f6836..479183690 100644 --- a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 +++ b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 @@ -14,12 +14,12 @@ $ConnectionStringSuffix = ";MultipleActiveResultSets=True;Connection Timeout=60; if ($Env:RUNNER_OS -eq "Windows") { $Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = - "Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True" + $ConnectionStringSuffix + "Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True" + $ConnectionStringSuffix } else { $Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = - "Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!" + $ConnectionStringSuffix + "Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!" + $ConnectionStringSuffix $Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = "sql2019" } @@ -38,7 +38,8 @@ $tests = dotnet sln list | Write-Output "Starting to execute tests from $($tests.Length) projects." -foreach ($test in $tests) { +foreach ($test in $tests) +{ # This could benefit from grouping, above the level of the potential groups created by the tests (the Lombiq UI # Testing Toolbox adds per-test groups too). However, there's no nested grouping, see # https://github.com/actions/runner/issues/1477. See the # c341ef145d2a0898c5900f64604b67b21d2ea5db commit for a @@ -55,8 +56,8 @@ foreach ($test in $tests) { # This is for xUnit ITestOutputHelper, see https://xunit.net/docs/capturing-output. '--logger', 'console;verbosity=detailed' '--verbosity', $Verbosity - $Filter Where-Object '--filter' : '' - $Filter Where-Object $Filter : '' + $Filter | Where-Object '--filter' : '' + $Filter | Where-Object $Filter : '' $test ) diff --git a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 index 56a3cc9ef..ea26a6146 100644 --- a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 +++ b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 @@ -3,7 +3,7 @@ New-Item -Type Directory "$Directory/FailureDumps" $testDirectory = "$Directory/test" -$rootDirectory = (Test-Path -Path $testDirectory) Where-Object $testDirectory : $Directory +$rootDirectory = (Test-Path -Path $testDirectory) | Where-Object $testDirectory : $Directory Get-ChildItem $rootDirectory -Recurse | Where-Object { $PSItem.Name -eq 'FailureDumps' } | diff --git a/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 b/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 index 02cf5d784..93317571d 100644 --- a/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 +++ b/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 @@ -1,19 +1,19 @@ param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] $MaxParallelThreads ) Write-Output "Setting maxParallelThreads in xunit.runner.json files to $MaxParallelThreads." $parameters = @{ - # -Filter is the fastest way to find files because its value is passed directly to the file system API. - Filter = "xunit.runner.json" - Recurse = $true - # -FollowSymLink is needed because without it errors will be thrown of type: - # "Get-ChildItem: The system cannot find the path specified." - FollowSymlink = $true - # Ignore warnings that will be printed due to multiple symlinks pointing to the same physical file. - WarningAction = "Ignore" + # -Filter is the fastest way to find files because its value is passed directly to the file system API. + Filter = "xunit.runner.json" + Recurse = $true + # -FollowSymLink is needed because without it errors will be thrown of type: + # "Get-ChildItem: The system cannot find the path specified." + FollowSymlink = $true + # Ignore warnings that will be printed due to multiple symlinks pointing to the same physical file. + WarningAction = "Ignore" } $configFiles = Get-ChildItem @parameters From 04192b6c5be271fb906eae5a39b6308044192cd4 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 17:31:18 +0100 Subject: [PATCH 03/20] Fixing code stying and indentation in build-and-test-orchard-core workflow --- .../workflows/build-and-test-orchard-core.yml | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build-and-test-orchard-core.yml b/.github/workflows/build-and-test-orchard-core.yml index 732724f20..e58c381f3 100644 --- a/.github/workflows/build-and-test-orchard-core.yml +++ b/.github/workflows/build-and-test-orchard-core.yml @@ -15,15 +15,15 @@ on: required: false type: string default: "true" - # This needs to be stringified JSON because inputs don't support arrays, see + # This needs to be stringified JSON because inputs don't support arrays, see # https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2. machine-types: required: false type: string default: "['ubuntu-22.04']" description: > - Stringified JSON array with the name of the type of machine(s) to run the workflow under, e.g. - "['ubuntu-22.04']" or "['ubuntu-22.04\", \"windows-2022']". + Stringified JSON array with the name of the type of machine(s) to run the workflow under, e.g. + "['ubuntu-22.04']" or "['ubuntu-22.04', 'windows-2022']". dotnet-version: required: false type: string @@ -136,7 +136,7 @@ on: required: false type: boolean default: true - description: > + description: > When set to true, it will be verified whether the NuGet packages of the .NET solution are consolidated, i.e. the same version of a given package is used in all projects. @@ -150,72 +150,72 @@ jobs: matrix: machine-type: ${{ fromJson(inputs.machine-types) }} timeout-minutes: - - ${{ inputs.timeout-minutes }} + - ${{ inputs.timeout-minutes }} timeout-minutes: ${{ matrix.timeout-minutes }} steps: - - name: Set Checkout Token - shell: pwsh - env: - CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }} - run: | - $checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}" - "CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV + - name: Set Checkout Token + shell: pwsh + env: + CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }} + run: | + $checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}" + "CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV - - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev - with: - token: ${{ env.CHECKOUT_TOKEN }} + - name: Checkout + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + with: + token: ${{ env.CHECKOUT_TOKEN }} - - name: Set up .NET - uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev - with: - dotnet-version: ${{ inputs.dotnet-version }} + - name: Set up .NET + uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev + with: + dotnet-version: ${{ inputs.dotnet-version }} - - name: Verify that .NET packages are consolidated - if: ${{ inputs.verify-dotnet-consolidation }} - uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@dev - with: - directory: ${{ inputs.build-directory }} + - name: Verify that .NET packages are consolidated + if: ${{ inputs.verify-dotnet-consolidation }} + uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@dev + with: + directory: ${{ inputs.build-directory }} - - name: Enable Node corepack - uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev + - name: Enable Node corepack + uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev - - name: Build and Static Code Analysis - uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev - with: - directory: ${{ inputs.build-directory }} - configuration: ${{ inputs.build-configuration}} - verbosity: ${{ inputs.build-verbosity }} - enable-code-analysis: ${{ inputs.build-enable-code-analysis }} - enable-nuget-caching: ${{ inputs.build-enable-nuget-caching }} - enable-npm-caching: ${{ inputs.build-enable-npm-caching }} - cache-version: ${{ inputs.build-cache-version }} - solution-or-project-path: ${{ inputs.build-solution-path }} - create-binary-log: ${{ inputs.build-create-binary-log}} + - name: Build and Static Code Analysis + uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev + with: + directory: ${{ inputs.build-directory }} + configuration: ${{ inputs.build-configuration}} + verbosity: ${{ inputs.build-verbosity }} + enable-code-analysis: ${{ inputs.build-enable-code-analysis }} + enable-nuget-caching: ${{ inputs.build-enable-nuget-caching }} + enable-npm-caching: ${{ inputs.build-enable-npm-caching }} + cache-version: ${{ inputs.build-cache-version }} + solution-or-project-path: ${{ inputs.build-solution-path }} + create-binary-log: ${{ inputs.build-create-binary-log}} - - name: Set up SQL Server - if: inputs.set-up-sql-server == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@dev + - name: Set up SQL Server + if: inputs.set-up-sql-server == 'true' + uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@dev - - name: Set up Azurite - if: inputs.set-up-azurite == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@dev - with: - location: ${{ inputs.build-directory}} + - name: Set up Azurite + if: inputs.set-up-azurite == 'true' + uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@dev + with: + location: ${{ inputs.build-directory}} - - name: Tests - if: inputs.test-disable == 'false' - uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev - with: - build-directory: ${{ inputs.build-directory }} - solution-path: ${{ inputs.build-solution-path }} - test-verbosity: ${{ inputs.build-verbosity }} - test-filter: ${{ inputs.test-filter }} - ui-test-parallelism: ${{ inputs.ui-test-parallelism }} - xunit-max-parallel-threads: ${{ inputs.xunit-max-parallel-threads }} + - name: Tests + if: inputs.test-disable == 'false' + uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev + with: + build-directory: ${{ inputs.build-directory }} + solution-path: ${{ inputs.build-solution-path }} + test-verbosity: ${{ inputs.build-verbosity }} + test-filter: ${{ inputs.test-filter }} + ui-test-parallelism: ${{ inputs.ui-test-parallelism }} + xunit-max-parallel-threads: ${{ inputs.xunit-max-parallel-threads }} - - name: Cancel Workflow on Failure - if: failure() && inputs.cancel-workflow-on-failure == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@dev - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Cancel Workflow on Failure + if: failure() && inputs.cancel-workflow-on-failure == 'true' + uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@dev + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f54f55244f11a36e5ee4b785db8c61332b1b599d Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 17:52:40 +0100 Subject: [PATCH 04/20] Updating action references to issue branch --- .../workflows/build-and-test-orchard-core.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-test-orchard-core.yml b/.github/workflows/build-and-test-orchard-core.yml index e58c381f3..c07cb1e1a 100644 --- a/.github/workflows/build-and-test-orchard-core.yml +++ b/.github/workflows/build-and-test-orchard-core.yml @@ -162,26 +162,26 @@ jobs: "CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-482 with: token: ${{ env.CHECKOUT_TOKEN }} - name: Set up .NET - uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev + uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@issue/OSOE-482 with: dotnet-version: ${{ inputs.dotnet-version }} - name: Verify that .NET packages are consolidated if: ${{ inputs.verify-dotnet-consolidation }} - uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@dev + uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@issue/OSOE-482 with: directory: ${{ inputs.build-directory }} - name: Enable Node corepack - uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev + uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@issue/OSOE-482 - name: Build and Static Code Analysis - uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev + uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@issue/OSOE-482 with: directory: ${{ inputs.build-directory }} configuration: ${{ inputs.build-configuration}} @@ -195,17 +195,17 @@ jobs: - name: Set up SQL Server if: inputs.set-up-sql-server == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@dev + uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@issue/OSOE-482 - name: Set up Azurite if: inputs.set-up-azurite == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@dev + uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@issue/OSOE-482 with: location: ${{ inputs.build-directory}} - name: Tests if: inputs.test-disable == 'false' - uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev + uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@issue/OSOE-482 with: build-directory: ${{ inputs.build-directory }} solution-path: ${{ inputs.build-solution-path }} @@ -216,6 +216,6 @@ jobs: - name: Cancel Workflow on Failure if: failure() && inputs.cancel-workflow-on-failure == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@dev + uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@issue/OSOE-482 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e0736e2d14050ec3ae02c56cd368a66ebaa4a40f Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 19:22:09 +0100 Subject: [PATCH 05/20] Fixing indentation and code styling in Set-XUnitMaxParallelThreads.ps1 --- .github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 b/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 index 5e7b4900d..e27cc66a8 100644 --- a/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 +++ b/.github/actions/test-dotnet/Set-XUnitMaxParallelThreads.ps1 @@ -7,8 +7,8 @@ Write-Output "Setting maxParallelThreads in xunit.runner.json files to $MaxParal $parameters = @{ # -Filter is the fastest way to find files because its value is passed directly to the file system API. - Filter = "xunit.runner.json" - Recurse = $true + Filter = "xunit.runner.json" + Recurse = $true # -FollowSymLink is needed because without it errors will be thrown of type: # "Get-ChildItem: The system cannot find the path specified." FollowSymlink = $true @@ -27,7 +27,7 @@ $configFiles | ForEach-Object { } else { - $json | Add-Member -Name 'maxParallelThreads' -value $MaxParallelThreads -MemberType NoteProperty + $json | Add-Member -Name 'maxParallelThreads' -Value $MaxParallelThreads -MemberType NoteProperty } ConvertTo-Json -InputObject $json > $PSItem From 2533bcd741e0d48138f4800c9a39338593eb33cb Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 20:03:21 +0100 Subject: [PATCH 06/20] Reverting incorrectly auto-fixed ternary operators --- .../build-dotnet/Build-DotNetSolutionOrProject.ps1 | 4 ++-- .../Initialize-IssueDetails.ps1 | 6 +++--- .../msbuild/Build-DotNetFrameworkSolutionOrProject.ps1 | 4 ++-- .github/actions/publish-nuget/New-NuGetPackage.ps1 | 2 +- .github/actions/setup-sql-server/Initialize-SqlServer.ps1 | 4 ++-- .github/actions/test-dotnet/Invoke-SolutionTests.ps1 | 8 ++++---- .github/actions/test-dotnet/Merge-FailureDumps.ps1 | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 b/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 index 7cd9e3044..1dbd3ccf3 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolutionOrProject.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [string] $Configuration, [string] $SolutionOrProject, [string] $Verbosity, @@ -54,7 +54,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution or project with the Lombiq.Analyzers files. The output and exit code are discarded because # they will be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and # the target will still run on the projects that have it. -dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $SolutionOrProject | Out-Null -or bash -c 'true' +dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $SolutionOrProject | Out-Null || bash -c 'true' Write-Output "Building solution or project with ``dotnet build $SolutionOrProject $($buildSwitches -join " ")``." diff --git a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 index 2b9533a86..a23c9ab67 100644 --- a/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 +++ b/.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 @@ -8,8 +8,8 @@ $PullReqestJiraIssueDescription ) -$context = [string]::IsNullOrEmpty($IssueComponent) | Where-Object $GitHub.repository : $IssueComponent -$titleSuffix = $SuffixIssueTitles | Where-Object " in $context" : "" +$context = [string]::IsNullOrEmpty($IssueComponent) ? $GitHub.repository : $IssueComponent +$titleSuffix = $SuffixIssueTitles ? " in $context" : "" Write-Output "Suffix: $titleSuffix" switch ($GitHub.event_name) @@ -54,7 +54,7 @@ switch ($GitHub.event_name) default { $message = "Unknown event `"$($GitHub.event_name)`". Please only call this script for one of the following " + - "events: discussion, issues, pull_request." + "events: discussion, issues, pull_request." Write-Error "::error::$message" exit 1 } diff --git a/.github/actions/msbuild/Build-DotNetFrameworkSolutionOrProject.ps1 b/.github/actions/msbuild/Build-DotNetFrameworkSolutionOrProject.ps1 index 9fa616fe9..506a51695 100644 --- a/.github/actions/msbuild/Build-DotNetFrameworkSolutionOrProject.ps1 +++ b/.github/actions/msbuild/Build-DotNetFrameworkSolutionOrProject.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [string] $SolutionOrProject, [string] $Verbosity, [string] $TreatWarningsAsErrors, @@ -68,7 +68,7 @@ msbuild $SolutionOrProject @buildSwitches # error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the # Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET -# Framework Developer Packs at https://aka.ms/msbuild/developerpacks +# Framework Developer Packs at https://aka.ms/msbuild/developerpacks if ($?) { diff --git a/.github/actions/publish-nuget/New-NuGetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 index 3372060b2..5deb7084a 100644 --- a/.github/actions/publish-nuget/New-NuGetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -16,7 +16,7 @@ param([array] $Arguments) -$projects = (Test-Path *.sln) | Where-Object (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) +$projects = (Test-Path *.sln) ? (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj) foreach ($project in $projects) { diff --git a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 index cba305f96..547a89c50 100644 --- a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 +++ b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 @@ -12,7 +12,7 @@ else '--detach', 'mcr.microsoft.com/mssql/server:2019-latest' ) - docker pull mcr.microsoft.com/mssql/server - docker run @dockerRunSwitches + docker pull mcr.microsoft.com/mssql/server && + docker run @dockerRunSwitches && docker exec --user 0 sql2019 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' } diff --git a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 index db1c6b5db..68a535977 100644 --- a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 +++ b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 @@ -14,12 +14,12 @@ $ConnectionStringSuffix = ";MultipleActiveResultSets=True;Connection Timeout=60; if ($Env:RUNNER_OS -eq "Windows") { $Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = - "Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True" + $ConnectionStringSuffix + "Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True" + $ConnectionStringSuffix } else { $Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = - "Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!" + $ConnectionStringSuffix + "Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!" + $ConnectionStringSuffix $Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = "sql2019" } @@ -63,8 +63,8 @@ foreach ($test in $tests) # This is for xUnit ITestOutputHelper, see https://xunit.net/docs/capturing-output. '--logger', 'console;verbosity=detailed' '--verbosity', $Verbosity - $Filter | Where-Object '--filter' : '' - $Filter | Where-Object $Filter : '' + $Filter ? '--filter' : '' + $Filter ? $Filter : '' $test ) diff --git a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 index ea26a6146..69aa2a6e6 100644 --- a/.github/actions/test-dotnet/Merge-FailureDumps.ps1 +++ b/.github/actions/test-dotnet/Merge-FailureDumps.ps1 @@ -3,7 +3,7 @@ New-Item -Type Directory "$Directory/FailureDumps" $testDirectory = "$Directory/test" -$rootDirectory = (Test-Path -Path $testDirectory) | Where-Object $testDirectory : $Directory +$rootDirectory = (Test-Path -Path $testDirectory) ? $testDirectory : $Directory Get-ChildItem $rootDirectory -Recurse | Where-Object { $PSItem.Name -eq 'FailureDumps' } | From 998ceeae76b1a7cb4bda5f7c704ec0f928dd73bf Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 20:05:09 +0100 Subject: [PATCH 07/20] Simplifying dotnet test parameter list construction in Invoke-SolutionTests.ps1 --- .github/actions/test-dotnet/Invoke-SolutionTests.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 index 68a535977..19ece8184 100644 --- a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 +++ b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 @@ -63,8 +63,7 @@ foreach ($test in $tests) # This is for xUnit ITestOutputHelper, see https://xunit.net/docs/capturing-output. '--logger', 'console;verbosity=detailed' '--verbosity', $Verbosity - $Filter ? '--filter' : '' - $Filter ? $Filter : '' + $Filter ? '--filter', $Filter : '' $test ) From 2b03c32fc5a7c78e4b75685fd9f40cc1e91b933e Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 20:07:49 +0100 Subject: [PATCH 08/20] Reverting auto-fix to replace curl with Invoke-WebRequest in Check-Parent --- .github/actions/verify-submodule-pull-request/Check-Parent.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 index 629d72767..36b6f11ba 100644 --- a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 +++ b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 @@ -4,7 +4,7 @@ ) $url = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100" -$titles = Invoke-WebRequest -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $PSItem.title } +$titles = curl -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $PSItem.title } if (!($Branch -match '(\w+-\d+)')) { From e7d774c4bc6880d78f867f7d782f773ba830892f Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Sun, 18 Dec 2022 20:08:11 +0100 Subject: [PATCH 09/20] Fixing code formatting in AddJiraIssueCodeToPullRequest and removing unused parameter --- .../AddJiraIssueCodeToPullRequest.ps1 | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/actions/add-jira-issue-code-to-pull-request/AddJiraIssueCodeToPullRequest.ps1 b/.github/actions/add-jira-issue-code-to-pull-request/AddJiraIssueCodeToPullRequest.ps1 index cd280ea2c..c67c0a4fd 100644 --- a/.github/actions/add-jira-issue-code-to-pull-request/AddJiraIssueCodeToPullRequest.ps1 +++ b/.github/actions/add-jira-issue-code-to-pull-request/AddJiraIssueCodeToPullRequest.ps1 @@ -2,7 +2,6 @@ param( [string] $JiraBaseUrl, [string] $GitHubRepository, [string] $Branch, - [string] $GitHubToken, [string] $Title, [string] $Body, [string] $PullRequestId @@ -13,7 +12,8 @@ $jiraBrowseUrl = $JiraBaseUrl + '/browse/'; $originalTitle = $Title $originalBody = $Body -if ($Branch -NotLike "*issue*") { +if ($Branch -NotLike "*issue*") +{ Exit } @@ -21,22 +21,27 @@ $Branch -match '(\w+-\d+)' $issueKey = $matches[0] $issueLink = "[$issueKey]($jiraBrowseUrl$issuekey)" -if ($Title -NotLike "*$issueKey*") { +if ($Title -NotLike "*$issueKey*") +{ $Title = $issueKey + ": " + $Title } -if (-Not $Body) { +if (-Not $Body) +{ $Body = $issueLink } -elseif ($Body -NotLike "*$issueKey*") { +elseif ($Body -NotLike "*$issueKey*") +{ $Body = $issueLink + "`n" + $Body } -elseif ($Body -NotLike "*``[$issueKey``]``($jiraBrowseUrl$issuekey``)*") { +elseif ($Body -NotLike "*``[$issueKey``]``($jiraBrowseUrl$issuekey``)*") +{ $Body = $Body.replace($issueKey, $issueLink) } -if (($Title -ne $originalTitle) -or ($Body -ne $originalBody)) { - $bodyParams = @{"title" = $Title; "body" = $Body} | ConvertTo-Json +if (($Title -ne $originalTitle) -or ($Body -ne $originalBody)) +{ + $bodyParams = @{"title" = $Title; "body" = $Body } | ConvertTo-Json $url = "https://api.github.com/repos/$GitHubRepository/pulls/$PullRequestId" Invoke-WebRequest $url -Headers (Get-GitHubApiAuthorizationHeader) -Method Patch -Body $bodyParams } From e41fd14fe984b1ee9c236aceacc5aab28430f2bc Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 19 Dec 2022 11:41:18 +0100 Subject: [PATCH 10/20] Updating Check-Parent script to use Invoke-WebRequest instead of curl --- .../verify-submodule-pull-request/Check-Parent.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 index 36b6f11ba..252b1e3c5 100644 --- a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 +++ b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 @@ -3,12 +3,17 @@ [string] $Branch ) -$url = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100" -$titles = curl -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $PSItem.title } +$ProgressPreference = "SilentlyContinue" +$requestParameters = @{ + Uri = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100" + Method = "Get" + Headers = @{ Accept = "application/vnd.github.v3+json" } +} +$titles = (Invoke-WebRequest @requestParameters).Content | ConvertFrom-Json | ForEach-Object { $PSItem.title } if (!($Branch -match '(\w+-\d+)')) { - Exit + exit } $issueCode = $matches[0] From d5237b9ea796e5c87866680288cd39577a4a185f Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 19 Dec 2022 12:14:36 +0100 Subject: [PATCH 11/20] Updating create-jira-issues-for-community-activities action to use Invoke-WebRequest instead of curl --- .../action.yml | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/actions/create-jira-issues-for-community-activities/action.yml b/.github/actions/create-jira-issues-for-community-activities/action.yml index b345bdbf0..9b94a26d1 100644 --- a/.github/actions/create-jira-issues-for-community-activities/action.yml +++ b/.github/actions/create-jira-issues-for-community-activities/action.yml @@ -12,8 +12,8 @@ inputs: required: false default: "true" description: > - If set to "true", Jira issue titles will be suffixed with "in " if the issue-component - parameter is specified, or the repository name. If set to "false", no suffix will be added to Jira issue titles. + If set to "true", Jira issue titles will be suffixed with "in " if the issue-component + parameter is specified, or the repository name. If set to "false", no suffix will be added to Jira issue titles. runs: using: "composite" @@ -100,21 +100,25 @@ runs: if: steps.issue-related-pr.outputs.is-issue-pr == 'False' shell: pwsh run: | - # Note that while --fail will fail the command if the request fails, it won't show the server output. Thus, - # remove for debugging. --fail-with-body provides that too, but is only available under curl >=7.76.0 which is - # not yet available for GitHub Actions, see https://github.com/Lombiq/GitHub-Actions/issues/53. - curl --request POST ` - --url '${{ env.JIRA_BASE_URL }}/rest/api/3/issue/${{ steps.create-issue.outputs.issue }}/remotelink' ` - --user '${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}' ` - --header 'Accept: application/json' ` - --header 'Content-Type: application/json' ` - --fail ` - --data '{ - \"object\": { - \"url\":\"${{ steps.issue-details.outputs.link-url }}\", - \"title\":\"${{ steps.issue-details.outputs.link-title }}\" - } - }' + $linkProperties = @{ + object = @{ + url = '${{ steps.issue-details.outputs.link-url }}' + title = '${{ steps.issue-details.outputs.link-title }}' + } + } + $requestParameters = @{ + Uri = '${{ env.JIRA_BASE_URL }}/rest/api/3/issue/${{ steps.create-issue.outputs.issue }}/remotelink' + Method = 'POST' + ContentType = 'application/json' + Headers = @{ + Accept = 'application/json' + Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}')) + ContentType = 'application/json' + } + Body = ConvertTo-Json($linkProperties) + } + + Invoke-WebRequest @requestParameters - name: Update GitHub Issue if: steps.issue-related-pr.outputs.is-issue-pr == 'False' && github.event.issue @@ -126,4 +130,4 @@ runs: issue-number: ${{ github.event.issue.number }} title: ${{ github.event.issue.title }} (${{ steps.create-issue.outputs.issue }}) body: "${{ github.event.issue.body }}\n\n[Jira issue](${{ env.JIRA_BASE_URL }}/browse/${{ steps.create-issue.outputs.issue }})" - update-mode: 'replace' + update-mode: "replace" From e5c22295fd70d504c4d78cb329cd510f29dbdc03 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 19 Dec 2022 12:36:48 +0100 Subject: [PATCH 12/20] Updating action references to issue branch in workflows --- .github/workflows/validate-submodule-pull-request.yml | 4 ++-- .github/workflows/validate-this-pull-request.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate-submodule-pull-request.yml b/.github/workflows/validate-submodule-pull-request.yml index dfabe6c58..8f4ace96b 100644 --- a/.github/workflows/validate-submodule-pull-request.yml +++ b/.github/workflows/validate-submodule-pull-request.yml @@ -22,14 +22,14 @@ jobs: steps: - name: Add Jira Issue Code to Pull Request if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@dev + uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@issue/OSOE-482 env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Ensure Parent PR Exists if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@dev + uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@issue/OSOE-482 with: title: ${{ github.event.pull_request.title }} repository: ${{ inputs.repository }} diff --git a/.github/workflows/validate-this-pull-request.yml b/.github/workflows/validate-this-pull-request.yml index 60853a4e9..365a1e21d 100644 --- a/.github/workflows/validate-this-pull-request.yml +++ b/.github/workflows/validate-this-pull-request.yml @@ -7,4 +7,4 @@ on: jobs: validate-pull-request: - uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@dev + uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@issue/OSOE-482 From c232f730110fe73f210fdafadfe0ff0c848b80cc Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 19 Dec 2022 12:37:10 +0100 Subject: [PATCH 13/20] Fixing indentation in validate-submodule-pull-request workflow --- .../validate-submodule-pull-request.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate-submodule-pull-request.yml b/.github/workflows/validate-submodule-pull-request.yml index 8f4ace96b..f02224021 100644 --- a/.github/workflows/validate-submodule-pull-request.yml +++ b/.github/workflows/validate-submodule-pull-request.yml @@ -2,7 +2,7 @@ name: Validate Pull Request on: workflow_call: - # We can't access org secrets here so they need to be passed in. + # We can't access org secrets here so they need to be passed in. secrets: JIRA_BASE_URL: required: false @@ -20,16 +20,16 @@ jobs: validate-submodule-pull-request: runs-on: ubuntu-22.04 steps: - - name: Add Jira Issue Code to Pull Request - if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@issue/OSOE-482 - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Add Jira Issue Code to Pull Request + if: github.event.pull_request != '' + uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@issue/OSOE-482 + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Ensure Parent PR Exists - if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@issue/OSOE-482 - with: - title: ${{ github.event.pull_request.title }} - repository: ${{ inputs.repository }} + - name: Ensure Parent PR Exists + if: github.event.pull_request != '' + uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@issue/OSOE-482 + with: + title: ${{ github.event.pull_request.title }} + repository: ${{ inputs.repository }} From 66961dfc7bb8aebcc939c7f3618f24b565d6d463 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 19 Dec 2022 19:26:53 +0100 Subject: [PATCH 14/20] Removing PS analyzer settings that allowed aliases according to comply with latest conventions (OSOE-472) --- PSScriptAnalyzerSettings.psd1 | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 PSScriptAnalyzerSettings.psd1 diff --git a/PSScriptAnalyzerSettings.psd1 b/PSScriptAnalyzerSettings.psd1 deleted file mode 100644 index 60d01b0fa..000000000 --- a/PSScriptAnalyzerSettings.psd1 +++ /dev/null @@ -1,7 +0,0 @@ -@{ - 'Rules' = @{ - 'PSAvoidUsingCmdletAliases' = @{ - 'allowlist' = @('%', '?') - } - } -} \ No newline at end of file From 9c456db8911fcc72be5cab9c088f1708d2515a8c Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 12:21:16 +0100 Subject: [PATCH 15/20] create-jira-issues-for-community-activities action: Updating the construction of the API request in the "Add Remote Link to Jira Issue" step --- .../create-jira-issues-for-community-activities/action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actions/create-jira-issues-for-community-activities/action.yml b/.github/actions/create-jira-issues-for-community-activities/action.yml index 9b94a26d1..badd2aa2d 100644 --- a/.github/actions/create-jira-issues-for-community-activities/action.yml +++ b/.github/actions/create-jira-issues-for-community-activities/action.yml @@ -106,19 +106,20 @@ runs: title = '${{ steps.issue-details.outputs.link-title }}' } } + $authorizationBytes = [Text.Encoding]::ASCII.GetBytes('${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}') + $authorizationBytesBase64 = [Convert]::ToBase64String($authorizationBytes) $requestParameters = @{ Uri = '${{ env.JIRA_BASE_URL }}/rest/api/3/issue/${{ steps.create-issue.outputs.issue }}/remotelink' Method = 'POST' ContentType = 'application/json' Headers = @{ Accept = 'application/json' - Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}')) - ContentType = 'application/json' + Authorization = "Basic $authorizationBytesBase64" } Body = ConvertTo-Json($linkProperties) } - Invoke-WebRequest @requestParameters + $response = Invoke-WebRequest @requestParameters - name: Update GitHub Issue if: steps.issue-related-pr.outputs.is-issue-pr == 'False' && github.event.issue From 7a2f58973f0da20a148ab9d08255e388f258a769 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 14:26:19 +0100 Subject: [PATCH 16/20] Updating create-jira-issues-for-community-activities to use the issue branch version of the underlying action --- .../workflows/create-jira-issues-for-community-activities.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-jira-issues-for-community-activities.yml b/.github/workflows/create-jira-issues-for-community-activities.yml index 89fbc2f76..1794b43aa 100644 --- a/.github/workflows/create-jira-issues-for-community-activities.yml +++ b/.github/workflows/create-jira-issues-for-community-activities.yml @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Create Jira issues for community activities - uses: Lombiq/GitHub-Actions/.github/actions/create-jira-issues-for-community-activities@dev + uses: Lombiq/GitHub-Actions/.github/actions/create-jira-issues-for-community-activities@issue/OSOE-482 env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} From eec00a115fe5b53703c69b2916095902eb4a8df7 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 14:32:25 +0100 Subject: [PATCH 17/20] Updating "Add Remote Link to Jira Issue" step in create-jira-issues-for-community-activities action for testing --- .../create-jira-issues-for-community-activities/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-jira-issues-for-community-activities/action.yml b/.github/actions/create-jira-issues-for-community-activities/action.yml index badd2aa2d..f583441a1 100644 --- a/.github/actions/create-jira-issues-for-community-activities/action.yml +++ b/.github/actions/create-jira-issues-for-community-activities/action.yml @@ -103,7 +103,7 @@ runs: $linkProperties = @{ object = @{ url = '${{ steps.issue-details.outputs.link-url }}' - title = '${{ steps.issue-details.outputs.link-title }}' + title = '${{ steps.issue-details.outputs.link-title }} opened with Invoke-WebRequest' } } $authorizationBytes = [Text.Encoding]::ASCII.GetBytes('${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}') @@ -119,7 +119,7 @@ runs: Body = ConvertTo-Json($linkProperties) } - $response = Invoke-WebRequest @requestParameters + Invoke-WebRequest @requestParameters - name: Update GitHub Issue if: steps.issue-related-pr.outputs.is-issue-pr == 'False' && github.event.issue From d2d99a4e8ef6532d1b50cb2ba1f01ef1614c019a Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 16:41:47 +0100 Subject: [PATCH 18/20] Removing ProgressPreference override from Check-Parent.ps1, because GHA doesn't care about the progress bar --- .github/actions/verify-submodule-pull-request/Check-Parent.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 index 252b1e3c5..cc60b4aef 100644 --- a/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 +++ b/.github/actions/verify-submodule-pull-request/Check-Parent.ps1 @@ -3,7 +3,6 @@ [string] $Branch ) -$ProgressPreference = "SilentlyContinue" $requestParameters = @{ Uri = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100" Method = "Get" From f0b061e3f617a570c7b850cd01a939174ac84f51 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 17:06:38 +0100 Subject: [PATCH 19/20] Reverting experimental/test change --- .../create-jira-issues-for-community-activities/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-jira-issues-for-community-activities/action.yml b/.github/actions/create-jira-issues-for-community-activities/action.yml index f583441a1..b715965c4 100644 --- a/.github/actions/create-jira-issues-for-community-activities/action.yml +++ b/.github/actions/create-jira-issues-for-community-activities/action.yml @@ -103,7 +103,7 @@ runs: $linkProperties = @{ object = @{ url = '${{ steps.issue-details.outputs.link-url }}' - title = '${{ steps.issue-details.outputs.link-title }} opened with Invoke-WebRequest' + title = '${{ steps.issue-details.outputs.link-title }}' } } $authorizationBytes = [Text.Encoding]::ASCII.GetBytes('${{ env.JIRA_USER_EMAIL }}:${{ env.JIRA_API_TOKEN }}') From fb7761469ba104b44651f7c3103e94af2d761d86 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Tue, 20 Dec 2022 18:27:34 +0100 Subject: [PATCH 20/20] Updating workflow branch references to dev --- .../workflows/build-and-test-orchard-core.yml | 18 +++++++++--------- ...te-jira-issues-for-community-activities.yml | 2 +- .../validate-submodule-pull-request.yml | 4 ++-- .../workflows/validate-this-pull-request.yml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-test-orchard-core.yml b/.github/workflows/build-and-test-orchard-core.yml index c07cb1e1a..e58c381f3 100644 --- a/.github/workflows/build-and-test-orchard-core.yml +++ b/.github/workflows/build-and-test-orchard-core.yml @@ -162,26 +162,26 @@ jobs: "CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev with: token: ${{ env.CHECKOUT_TOKEN }} - name: Set up .NET - uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev with: dotnet-version: ${{ inputs.dotnet-version }} - name: Verify that .NET packages are consolidated if: ${{ inputs.verify-dotnet-consolidation }} - uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@dev with: directory: ${{ inputs.build-directory }} - name: Enable Node corepack - uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev - name: Build and Static Code Analysis - uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev with: directory: ${{ inputs.build-directory }} configuration: ${{ inputs.build-configuration}} @@ -195,17 +195,17 @@ jobs: - name: Set up SQL Server if: inputs.set-up-sql-server == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@dev - name: Set up Azurite if: inputs.set-up-azurite == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/setup-azurite@dev with: location: ${{ inputs.build-directory}} - name: Tests if: inputs.test-disable == 'false' - uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev with: build-directory: ${{ inputs.build-directory }} solution-path: ${{ inputs.build-solution-path }} @@ -216,6 +216,6 @@ jobs: - name: Cancel Workflow on Failure if: failure() && inputs.cancel-workflow-on-failure == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@dev env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-jira-issues-for-community-activities.yml b/.github/workflows/create-jira-issues-for-community-activities.yml index 1794b43aa..89fbc2f76 100644 --- a/.github/workflows/create-jira-issues-for-community-activities.yml +++ b/.github/workflows/create-jira-issues-for-community-activities.yml @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Create Jira issues for community activities - uses: Lombiq/GitHub-Actions/.github/actions/create-jira-issues-for-community-activities@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/create-jira-issues-for-community-activities@dev env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} diff --git a/.github/workflows/validate-submodule-pull-request.yml b/.github/workflows/validate-submodule-pull-request.yml index f02224021..d662cc687 100644 --- a/.github/workflows/validate-submodule-pull-request.yml +++ b/.github/workflows/validate-submodule-pull-request.yml @@ -22,14 +22,14 @@ jobs: steps: - name: Add Jira Issue Code to Pull Request if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/add-jira-issue-code-to-pull-request@dev env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Ensure Parent PR Exists if: github.event.pull_request != '' - uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@dev with: title: ${{ github.event.pull_request.title }} repository: ${{ inputs.repository }} diff --git a/.github/workflows/validate-this-pull-request.yml b/.github/workflows/validate-this-pull-request.yml index 365a1e21d..60853a4e9 100644 --- a/.github/workflows/validate-this-pull-request.yml +++ b/.github/workflows/validate-this-pull-request.yml @@ -7,4 +7,4 @@ on: jobs: validate-pull-request: - uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@issue/OSOE-482 + uses: Lombiq/GitHub-Actions/.github/workflows/validate-submodule-pull-request.yml@dev