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
4 changes: 2 additions & 2 deletions .github/workflows/workflow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}' == '' ]]"

Expand Down
11 changes: 7 additions & 4 deletions updater/tests/update-dependency.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
16 changes: 15 additions & 1 deletion updater/tests/workflow-args.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading