diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index 5867c33..aeeb351 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -40,8 +40,8 @@ jobs: - run: "[[ '${{ needs.updater-create-pr.outputs.prBranch }}' == 'deps/updater/tests/sentry-cli.properties' ]]" - run: "[[ '${{ needs.updater-test-args.outputs.baseBranch }}' == '' ]]" - - run: "[[ '${{ needs.updater-test-args.outputs.originalTag }}' == 'latest' ]]" - - run: "[[ '${{ needs.updater-test-args.outputs.latestTag }}' == 'latest' ]]" + - run: "[[ '${{ needs.updater-test-args.outputs.originalTag }}' == 'latest' || '${{ needs.updater-test-args.outputs.originalTag }}' =~ ^v?[0-9]+\\.[0-9]+\\.[0-9]+$ ]]" + - run: "[[ '${{ needs.updater-test-args.outputs.originalTag }}' == '${{ needs.updater-test-args.outputs.latestTag }}' ]]" - run: "[[ '${{ needs.updater-test-args.outputs.prUrl }}' == '' ]]" - run: "[[ '${{ needs.updater-test-args.outputs.prBranch }}' == '' ]]" diff --git a/updater/tests/update-dependency.Tests.ps1 b/updater/tests/update-dependency.Tests.ps1 index 23c5c10..1437fba 100644 --- a/updater/tests/update-dependency.Tests.ps1 +++ b/updater/tests/update-dependency.Tests.ps1 @@ -16,10 +16,13 @@ BeforeAll { } $repoUrl = 'https://github.com/getsentry/github-workflows' - # Find the latest latest version in this repo. We're intentionally using different code than `update-dependency.ps1` - # script uses to be able to catch issues, if any. - $currentVersion = (git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' $repoUrl ` - | Select-Object -Last 1 | Select-String -Pattern 'refs/tags/(.*)$').Matches.Groups[1].Value + # Find the latest latest version in this repo using the same logic as update-dependency.ps1 + . "$PSScriptRoot/../scripts/common.ps1" + [string[]]$tags = $(git ls-remote --refs --tags $repoUrl) + $tags = $tags | ForEach-Object { ($_ -split '\s+')[1] -replace '^refs/tags/', '' } + $tags = $tags -match '^v?([0-9.]+)$' + $tags = & "$PSScriptRoot/../scripts/sort-versions.ps1" $tags + $currentVersion = $tags[-1] } Describe ('update-dependency') { diff --git a/updater/tests/workflow-args.sh b/updater/tests/workflow-args.sh old mode 100644 new mode 100755 index 6b8d1d4..8d68c11 --- a/updater/tests/workflow-args.sh +++ b/updater/tests/workflow-args.sh @@ -5,7 +5,21 @@ set -euo pipefail case $1 in get-version) - echo "latest" + # Return the actual latest tag to ensure no update is needed + # Always use remote lookup for consistency with update-dependency.ps1 + tags=$(git ls-remote --tags --refs https://github.com/getsentry/github-workflows.git | \ + sed 's/.*refs\/tags\///' | \ + grep -E '^v?[0-9.]+$') + + # Sort by version number, handling mixed v prefixes + latest=$(echo "$tags" | sed 's/^v//' | sort -V | tail -1) + + # Check if original had v prefix and restore it + if echo "$tags" | grep -q "^v$latest$"; then + echo "v$latest" + else + echo "$latest" + fi # Run actual tests here. if [[ "$(uname)" != 'Darwin' ]]; then