Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions .github/workflows/update-powershell-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion dependency-updates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand All @@ -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')
}
}

Expand Down
17 changes: 5 additions & 12 deletions dependency-updates/Update-RepositoryDependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -125,10 +122,7 @@ function Invoke-RepositoryDependencyUpdate {
[String]$ModuleName,

[Parameter(Mandatory)]
[String]$StandardsVersion,

[Parameter()]
[Switch]$AllowMajorVersionUpgrade
[String]$StandardsVersion
)

$resolvedRepositoryPath = (Resolve-Path -LiteralPath $RepositoryPath).ProviderPath
Expand Down Expand Up @@ -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
Expand Down