Skip to content

Commit 51ccb91

Browse files
authored
Fix PR creation (#908)
1 parent 1a10273 commit 51ccb91

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/workflow/git_patch.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ func (c *Compiler) generateGitPatchStep(yaml *strings.Builder) {
6262
yaml.WriteString(" else\n")
6363
yaml.WriteString(" echo \"origin/$BRANCH_NAME does not exist, using merge-base with default branch\"\n")
6464
yaml.WriteString(" # Get the default branch name\n")
65-
yaml.WriteString(" DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\n")
65+
yaml.WriteString(" DEFAULT_BRANCH=\"${{ github.event.repository.default_branch }}\"\n")
6666
yaml.WriteString(" echo \"Default branch: $DEFAULT_BRANCH\"\n")
67+
yaml.WriteString(" # Fetch the default branch to ensure it's available locally\n")
68+
yaml.WriteString(" git fetch origin $DEFAULT_BRANCH\n")
6769
yaml.WriteString(" # Find merge base between default branch and current branch\n")
6870
yaml.WriteString(" BASE_REF=$(git merge-base origin/$DEFAULT_BRANCH $BRANCH_NAME)\n")
6971
yaml.WriteString(" echo \"Using merge-base as base: $BASE_REF\"\n")

0 commit comments

Comments
 (0)