From 55251f7cc3593815dc2f5eba9fd86b7b03ae39de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 00:29:30 +0000 Subject: [PATCH] Show actual branch name and separate PR row in repository information Agent-Logs-Url: https://github.com/cmderdev/cmder/sessions/7ac9b75c-de48-4c0b-98db-108cc3423c0e Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com> --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47e8761..57feccf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,19 +48,35 @@ 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 }}" + # Determine branch and PR information + $refName = "${{ github.ref_name }}" + $headRef = "${{ github.head_ref }}" + $eventName = "${{ github.event_name }}" + $prNumber = $null + $actualBranchName = $refName $branchLink = "" - if ($branchName -match '^(\d+)/(merge|head)$') { - # This is a PR merge/head ref, link to the PR + $prLink = "" + + # Check if this is a PR merge ref (e.g., "3061/merge") + if ($refName -match '^(\d+)/(merge|head)$') { $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 }}" + # Use head_ref for the actual branch name if available + if ($headRef) { + $actualBranchName = $headRef + } + $branchLink = "https://github.com/${{ github.repository }}/tree/$actualBranchName" + $prLink = "https://github.com/${{ github.repository }}/pull/$prNumber" + } elseif ($eventName -eq "pull_request") { + # This is a pull request event + $prNumber = "${{ github.event.pull_request.number }}" + if ($headRef) { + $actualBranchName = $headRef + } + $branchLink = "https://github.com/${{ github.repository }}/tree/$actualBranchName" + $prLink = "https://github.com/${{ github.repository }}/pull/$prNumber" } else { # Regular branch, link to the branch tree - $branchLink = "https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}" + $branchLink = "https://github.com/${{ github.repository }}/tree/$refName" } $summary = @" @@ -72,7 +88,8 @@ jobs: | Property | Value | | --- | --- | | Repository | [``${{ github.repository }}``](https://github.com/${{ github.repository }}) | - | Branch | [``$branchName``]($branchLink) | + | Branch | [``$actualBranchName``]($branchLink) | + $(if ($prNumber) { "| Pull Request | [#$prNumber]($prLink) |" }) | Commit | [``${{ github.sha }}``](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | | Actor | [@${{ github.actor }}](https://github.com/${{ github.actor }}) | | Workflow | ``${{ github.workflow }}`` |