Skip to content

Commit

Permalink
get correct branch name for deployment target (#3653)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianedwards authored Sep 27, 2023
1 parent 9582b94 commit ecd89e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cli/cmd/v2/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,12 @@ func deploymentTargetFromConfig(ctx context.Context, client api.Client, projectI

if previewApply {
var branchName string
if os.Getenv("GITHUB_REF_NAME") != "" {

// branch name is set to different values in the GH env, depending on whether or not the workflow is triggered by a PR
// issue is being tracked here: https://github.com/github/docs/issues/15319
if os.Getenv("GITHUB_HEAD_REF") != "" {
branchName = os.Getenv("GITHUB_HEAD_REF")
} else if os.Getenv("GITHUB_REF_NAME") != "" {
branchName = os.Getenv("GITHUB_REF_NAME")
} else if branch, err := git.CurrentBranch(); err == nil {
branchName = branch
Expand Down

0 comments on commit ecd89e9

Please sign in to comment.