File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 3232 Write-Host "Short hash: $(git rev-parse --short HEAD)"
3333 Write-Host "Git describe: $(git describe --tags)"
3434 Write-Host "Branch: ${{ github.ref_name }}"
35+ Write-Host "Event: ${{ github.event_name }}"
36+ Write-Host "Head ref: ${{ github.head_ref }}"
37+ shell : pwsh
38+ - name : Set version override
39+ run : |
40+ # For PR builds, use the source branch name and ignore height
41+ if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
42+ $branchName = "${{ github.head_ref }}"
43+ Write-Host "PR build from branch: $branchName"
44+
45+ # Sanitize branch name for version (replace invalid chars with dash)
46+ $branchName = $branchName -replace '[/\\]', '-'
47+ $branchName = $branchName -replace '[^a-zA-Z0-9\-]', ''
48+
49+ # Set the pre-release identifier
50+ $preRelease = "octopus-$branchName.${{ github.run_number }}"
51+ Write-Host "Setting MinVerDefaultPreReleaseIdentifiers to: $preRelease"
52+ "MINVERDEFAULTPRERELEASEIDENTIFIERS=$preRelease" >> $env:GITHUB_ENV
53+
54+ # Ignore height - use run number instead
55+ Write-Host "Ignoring git height"
56+ "MINVERIGNOHEIGHT=true" >> $env:GITHUB_ENV
57+ } else {
58+ Write-Host "Not a PR build - using standard MinVer behavior"
59+ }
3560 shell : pwsh
3661 - name : Install .NET SDK
3762 uses : actions/setup-dotnet@v4.0.0
You can’t perform that action at this time.
0 commit comments