Skip to content

Commit

Permalink
Makes minor version checking configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
jessehouwing committed Oct 30, 2023
1 parent d5eb44f commit 6a3f08e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions main.ps1
Original file line number Diff line number Diff line change
@@ -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+)*$") }

Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit 6a3f08e

Please sign in to comment.