From a5bbd6f75460a37990c939f68039ee0788ca45cb Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Thu, 3 Oct 2024 17:01:00 +0200 Subject: [PATCH 1/4] fix hasFiles expression --- .github/workflows/update-generated-text.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-generated-text.yml b/.github/workflows/update-generated-text.yml index 860eff96..2d99e4da 100644 --- a/.github/workflows/update-generated-text.yml +++ b/.github/workflows/update-generated-text.yml @@ -18,7 +18,7 @@ jobs: uses: actions/cache@v3 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules - key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1, **/buildtools.ps1') }} + key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1', '**/buildtools.ps1') }} - name: Prerequisites if: steps.cache-powershell-modules.outputs.cache-hit != 'true' shell: powershell From 273cb1fb9be2ec2f72ba6d2accf0eceb27481a73 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Thu, 3 Oct 2024 17:12:05 +0200 Subject: [PATCH 2/4] update action versions --- .github/workflows/build.yml | 28 ++++++++++----------- .github/workflows/update-generated-text.yml | 6 ++--- .github/workflows/update-wiki.yml | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de416cb9..2f0043f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,9 +15,9 @@ jobs: name: Prerequisites runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1') }} @@ -30,10 +30,10 @@ jobs: runs-on: windows-latest needs: prerequisites steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules id: cache-powershell-modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1') }} @@ -46,7 +46,7 @@ jobs: run: build\vsts-validate.ps1 -TestGeneral $true -TestFunctions $false -Exclude "PSScriptAnalyzer.Tests.ps1" - name: Publish Test Results **/TEST-*.xml if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@v2 + uses: EnricoMi/publish-unit-test-result-action/windows@v2 with: files: '**/TEST-*.xml' check_name: 'General Unit Tests Results' @@ -57,10 +57,10 @@ jobs: runs-on: windows-latest needs: prerequisites steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules id: cache-powershell-modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1') }} @@ -73,7 +73,7 @@ jobs: run: build\vsts-validate-psscriptanalyzer.ps1 -TestPublic $true -TestInternal $false - name: Publish Test Results **/TEST-*.xml if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@v2 + uses: EnricoMi/publish-unit-test-result-action/windows@v2 with: files: '**/TEST-*.xml' check_name: 'Public Functions Unit Tests Results' @@ -84,10 +84,10 @@ jobs: runs-on: windows-latest needs: Prerequisites steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules id: cache-powershell-modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1') }} @@ -100,7 +100,7 @@ jobs: run: build\vsts-validate-psscriptanalyzer.ps1 -TestPublic $false -TestInternal $true - name: Publish Test Results **/TEST-*.xml if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@v2 + uses: EnricoMi/publish-unit-test-result-action/windows@v2 with: files: '**/TEST-*.xml' check_name: 'Internal Functions Unit Tests Results' @@ -111,10 +111,10 @@ jobs: runs-on: windows-latest needs: prerequisites steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules id: cache-powershell-modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1') }} @@ -127,7 +127,7 @@ jobs: run: build\vsts-validate.ps1 -TestGeneral $false -TestFunctions $true - name: Publish Test Results **/TEST-*.xml if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@v2 + uses: EnricoMi/publish-unit-test-result-action/windows@v2 with: files: '**/TEST-*.xml' check_name: 'Individual Unit Tests Results' diff --git a/.github/workflows/update-generated-text.yml b/.github/workflows/update-generated-text.yml index 2d99e4da..11eaa17a 100644 --- a/.github/workflows/update-generated-text.yml +++ b/.github/workflows/update-generated-text.yml @@ -12,10 +12,10 @@ jobs: name: Generate text runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Powershell Modules id: cache-powershell-modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules key: 20210527|${{ hashFiles('**/vsts-prerequisites.ps1', '**/buildtools.ps1') }} @@ -40,7 +40,7 @@ jobs: shell: powershell run: build\generate-findcommandindex.ps1 - name: Create a pull request for changes - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v7 with: commit-message: | 🤖 Fix best practice deviations diff --git a/.github/workflows/update-wiki.yml b/.github/workflows/update-wiki.yml index c6ad416f..5c0389ac 100644 --- a/.github/workflows/update-wiki.yml +++ b/.github/workflows/update-wiki.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Publish wiki folder to repository wiki uses: FH-Inway/github-wiki-publish-action@rsync From ba66eeb86540e59762339955c35b5a293a655682 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 5 Oct 2024 13:16:42 +0200 Subject: [PATCH 3/4] log information about installed modules --- build/buildtools.ps1 | 3 ++- build/vsts-prerequisites.ps1 | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build/buildtools.ps1 b/build/buildtools.ps1 index 5d607234..1d1c8f44 100644 --- a/build/buildtools.ps1 +++ b/build/buildtools.ps1 @@ -14,6 +14,7 @@ foreach ($item in $modules) { Write-Host "Installing $item" -ForegroundColor Cyan Install-Module -Name $item -Force -Confirm:$false -Scope CurrentUser -AllowClobber -SkipPublisherCheck } - + Import-Module $item -Force + Get-Module -Name $item } \ No newline at end of file diff --git a/build/vsts-prerequisites.ps1 b/build/vsts-prerequisites.ps1 index 68dda50d..4e822b9f 100644 --- a/build/vsts-prerequisites.ps1 +++ b/build/vsts-prerequisites.ps1 @@ -4,6 +4,7 @@ Write-Host "The user running is: $($env:UserName)" # $modules = @("PSFramework", "Az.Storage", "AzureAd", "PSNotification", "PSOAuthHelper", "PowerShellGet", "PackageManagement","ImportExcel","PSScriptAnalyzer") $modules = @("PSFramework", "PSScriptAnalyzer", "Az.Storage", "AzureAd", "PSNotification", "PSOAuthHelper", "ImportExcel") +Write-Host "Installing Pester, maximum version 4.99.99" -ForegroundColor Cyan Install-Module "Pester" -MaximumVersion 4.99.99 -Force -Confirm:$false -Scope CurrentUser -AllowClobber -SkipPublisherCheck foreach ($item in $modules) { @@ -14,6 +15,7 @@ foreach ($item in $modules) { Write-Host "Installing $item" -ForegroundColor Cyan Install-Module -Name $item -Force -Confirm:$false -Scope CurrentUser -AllowClobber -SkipPublisherCheck } - + Import-Module $item -Force + Get-Module -Name $item } \ No newline at end of file From 8eaee90c0faa624d729c820cdccf2664cb5eb7d0 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 5 Oct 2024 13:42:35 +0200 Subject: [PATCH 4/4] create unique patch branch name for each pull request branch Previously, if there were multiple pull requests A and B active at the same time, a run of this action for B would overwrite the branch with the fixes from a previous run for A. --- .github/workflows/update-generated-text.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-generated-text.yml b/.github/workflows/update-generated-text.yml index 11eaa17a..9cdfab18 100644 --- a/.github/workflows/update-generated-text.yml +++ b/.github/workflows/update-generated-text.yml @@ -47,4 +47,5 @@ jobs: This pull request was automatically created by the d365fo.tools-Generate-Text action' title: '🤖 Fix best practice deviations' - body: 'This pull request was automatically created by the d365fo.tools-Generate-Text action. See [Building tools](https://github.com/d365collaborative/d365fo.tools/wiki/Building-tools) for more information.' \ No newline at end of file + body: 'This pull request was automatically created by the d365fo.tools-Generate-Text action. See [Building tools](https://github.com/d365collaborative/d365fo.tools/wiki/Building-tools) for more information.' + branch: 'update-generated-text/pull-request-patch-for-branch-${{ github.ref_name }}' \ No newline at end of file