Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* [PR-10](https://github.com/rimi-itk/gh-itkdev/pull/10)
Added release base branch detection
* [PR-7](https://github.com/rimi-itk/gh-itkdev/pull/7)
Fixed URL parsing

Expand Down
16 changes: 14 additions & 2 deletions cmd/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"os/exec"

"github.com/rimi-itk/gh-itkdev/changelog"
"github.com/spf13/cobra"
Expand All @@ -16,8 +17,19 @@ var (
{{ .Title }}`

release string
baseBranch string = "develop"
commit bool = false
baseBranch string = func() string {
branches := []string{"develop", "main", "master"}
for _, branch := range branches {
cmd := exec.Command("git", "rev-parse", "--verify", "--branch", branch)
if _, err := cmd.CombinedOutput(); err == nil {
return branch
}
}

// Fallback if no other suitable branch is found.
return branches[0]
}()
commit bool = false

changelogName string = "CHANGELOG.md"

Expand Down
Loading