Skip to content

Commit 65373d7

Browse files
authored
Fix "Edit This File" path (#790)
* Acquire the branch name as a new variable, keeping github.ref_name as a fallback.
1 parent 5b1f10d commit 65373d7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

.github/workflows/preview-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
env:
116116
PR_NUMBER: ${{ github.event.pull_request.number }}
117117
GITHUB_REF_NAME: ${{ github.ref_name }}
118+
GITHUB_PR_REF_NAME: ${{ github.event.pull_request.head.ref }}
118119
run: |
119120
case "${GITHUB_EVENT_NAME}" in
120121
"merge_group" | "pull_request" | "pull_request_target")

src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static GitCheckoutInformation Create(IDirectoryInfo? source, IFileSystem
6767
branch = branch.Replace("ref: ", string.Empty);
6868
}
6969
else
70-
branch = "detached/head";
70+
branch = Environment.GetEnvironmentVariable("GITHUB_PR_REF_NAME") ?? Environment.GetEnvironmentVariable("GITHUB_REF_NAME") ?? "detached/head";
7171

7272
var ini = new IniFile();
7373
using var stream = gitConfig.OpenRead();

0 commit comments

Comments
 (0)