diff --git a/.github/workflows/update-powershell-dependencies.yml b/.github/workflows/update-powershell-dependencies.yml index e7ceeb9..0ad051d 100644 --- a/.github/workflows/update-powershell-dependencies.yml +++ b/.github/workflows/update-powershell-dependencies.yml @@ -10,11 +10,6 @@ on: required: true default: all type: string - allow_major_version_upgrade: - description: Allow dependencies to cross major-version boundaries - required: true - default: false - type: boolean permissions: contents: read @@ -93,18 +88,11 @@ jobs: - name: Update dependencies shell: pwsh env: - ALLOW_MAJOR_VERSION_UPGRADE: ${{ inputs.allow_major_version_upgrade }} GITHUB_TOKEN: ${{ github.token }} run: | - $parameters = @{ - RepositoryPath = './target' - ModuleName = '${{ matrix.target.module }}' - } - if ($env:ALLOW_MAJOR_VERSION_UPGRADE -eq 'true') { - $parameters.AllowMajorVersionUpgrade = $true - } - - ./controller/dependency-updates/Update-RepositoryDependencies.ps1 @parameters + ./controller/dependency-updates/Update-RepositoryDependencies.ps1 ` + -RepositoryPath './target' ` + -ModuleName '${{ matrix.target.module }}' - name: Create or refresh pull request uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 diff --git a/dependency-updates/README.md b/dependency-updates/README.md index c92db3d..7998fef 100644 --- a/dependency-updates/README.md +++ b/dependency-updates/README.md @@ -32,4 +32,5 @@ The workflow requests a short-lived token for one target repository at a time. Run **PowerShell dependency updates** from the Actions page. Use `all` to process every configured repository or provide one repository name from `targets.json`. -Scheduled runs preserve dependency major versions; manual runs can explicitly allow major upgrades. +Scheduled and manual runs preserve dependency major versions. Major dependency upgrades are handled +manually in the target repository so their compatibility changes can be reviewed together. diff --git a/dependency-updates/Tests/Update-RepositoryDependencies.Tests.ps1 b/dependency-updates/Tests/Update-RepositoryDependencies.Tests.ps1 index 9f69544..b18b1cb 100644 --- a/dependency-updates/Tests/Update-RepositoryDependencies.Tests.ps1 +++ b/dependency-updates/Tests/Update-RepositoryDependencies.Tests.ps1 @@ -61,7 +61,7 @@ Describe 'Update-RepositoryDependencies' { } | Should -Not -Throw } - It 'passes the declared files and major-upgrade choice to Standards' { + It 'passes the declared files to Standards without enabling major upgrades' { $repositoryPath = Join-Path $TestDrive 'delegation' New-TestRepository -Path $repositoryPath Set-Content ` @@ -77,14 +77,13 @@ Describe 'Update-RepositoryDependencies' { $result = Invoke-RepositoryDependencyUpdate ` -RepositoryPath $repositoryPath ` -ModuleName TestModule ` - -StandardsVersion '0.3.1' ` - -AllowMajorVersionUpgrade + -StandardsVersion '0.3.1' $result.Changed | Should -BeTrue Should -Invoke Invoke-StandardsDependencyUpdate -Times 1 -ParameterFilter { $Parameters.BuildRequirementsPath -eq (Join-Path $repositoryPath 'Tools/build.requirements.psd1') -and $Parameters.ManifestPath -eq (Join-Path $repositoryPath 'TestModule/TestModule.psd1') -and - $Parameters.AllowMajorVersionUpgrade + -not $Parameters.ContainsKey('AllowMajorVersionUpgrade') } } diff --git a/dependency-updates/Update-RepositoryDependencies.ps1 b/dependency-updates/Update-RepositoryDependencies.ps1 index a861be8..ef53bf6 100644 --- a/dependency-updates/Update-RepositoryDependencies.ps1 +++ b/dependency-updates/Update-RepositoryDependencies.ps1 @@ -12,10 +12,7 @@ param( [Parameter()] [ValidatePattern('^\d+\.\d+\.\d+$')] - [String]$StandardsVersion = '0.3.1', - - [Parameter()] - [Switch]$AllowMajorVersionUpgrade + [String]$StandardsVersion = '0.3.1' ) $ErrorActionPreference = 'Stop' @@ -125,10 +122,7 @@ function Invoke-RepositoryDependencyUpdate { [String]$ModuleName, [Parameter(Mandatory)] - [String]$StandardsVersion, - - [Parameter()] - [Switch]$AllowMajorVersionUpgrade + [String]$StandardsVersion ) $resolvedRepositoryPath = (Resolve-Path -LiteralPath $RepositoryPath).ProviderPath @@ -173,10 +167,9 @@ function Invoke-RepositoryDependencyUpdate { Import-Module AtlassianPS.Standards -RequiredVersion $StandardsVersion -Force -ErrorAction Stop $updateParameters = @{ - BuildRequirementsPath = $buildRequirementsPath - ManifestPath = $manifestPath - AllowMajorVersionUpgrade = $AllowMajorVersionUpgrade - ErrorAction = 'Stop' + BuildRequirementsPath = $buildRequirementsPath + ManifestPath = $manifestPath + ErrorAction = 'Stop' } $result = Invoke-StandardsDependencyUpdate -Parameters $updateParameters