mirror of
https://github.com/cmderdev/cmder.git
synced 2025-12-15 18:21:39 +08:00
Fix branch link for PR merge refs to point to PR instead of invalid tree URL
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@@ -47,6 +47,21 @@ jobs:
|
||||
$cmderVersion = Get-VersionStr
|
||||
$buildTime = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
||||
|
||||
# Determine branch link (handle PR merge refs)
|
||||
$branchName = "${{ github.ref_name }}"
|
||||
$branchLink = ""
|
||||
if ($branchName -match '^(\d+)/(merge|head)$') {
|
||||
# This is a PR merge/head ref, link to the PR
|
||||
$prNumber = $Matches[1]
|
||||
$branchLink = "https://github.com/${{ github.repository }}/pull/$prNumber"
|
||||
} elseif ("${{ github.event_name }}" -eq "pull_request") {
|
||||
# This is a pull request event, link to the PR
|
||||
$branchLink = "https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
|
||||
} else {
|
||||
# Regular branch, link to the branch tree
|
||||
$branchLink = "https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}"
|
||||
}
|
||||
|
||||
$summary = @"
|
||||
## 📦 Build Cmder - Workflow Summary
|
||||
|
||||
@@ -56,7 +71,7 @@ jobs:
|
||||
| Property | Value |
|
||||
| --- | --- |
|
||||
| Repository | [``${{ github.repository }}``](https://github.com/${{ github.repository }}) |
|
||||
| Branch | [``${{ github.ref_name }}``](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}) |
|
||||
| Branch | [``$branchName``]($branchLink) |
|
||||
| Commit | [``${{ github.sha }}``](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
|
||||
| Actor | [@${{ github.actor }}](https://github.com/${{ github.actor }}) |
|
||||
| Workflow | ``${{ github.workflow }}`` |
|
||||
|
||||
Reference in New Issue
Block a user