From 6a3f08ea10ff7177192c4d5572b98adb1fdb7a98 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Mon, 30 Oct 2023 11:13:18 +0000 Subject: [PATCH] Makes minor version checking configurable --- action.yaml | 6 ++++++ main.ps1 | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index a4f1ffe..0c9a820 100644 --- a/action.yaml +++ b/action.yaml @@ -3,6 +3,12 @@ description: 'Checks the version tags for your action repository to ensure the c branding: icon: 'check-circle' color: 'orange' +inputs: + check_minor_version: + description: "Configures warnings for minor versions (options: [true, false], default: true)." + required: false + default: "true" + runs: using: "composite" steps: diff --git a/main.ps1 b/main.ps1 index 931be75..cf00025 100644 --- a/main.ps1 +++ b/main.ps1 @@ -1,5 +1,6 @@ $global:returnCode = 0 -$warnMinor = $true + +$warnMinor = $env:INPUT_CHECK_MINOR_VERSION -eq "true" $tags = & git tag -l v* | Where-Object{ return ($_ -match "v\d+(.\d+)*$") } @@ -135,7 +136,7 @@ foreach ($majorVersion in $majorVersions) write-actions-error "::error title=Missing version::Version: v$($majorVersion.major) does not exist and must match: v$($highestMinor.major).$($highestMinor.minor) ref $minorSha" } - if ($minorSha -and ($majorSha -ne $minorSha)) + if ($warnMinor -and $minorSha -and ($majorSha -ne $minorSha)) { write-actions-error "::error title=Incorrect version::Version: v$($majorVersion.major) ref $majorSha must match: v$($highestMinor.major).$($highestMinor.minor) ref $minorSha" }