feat: support branch creation from 'main' for hotfixes and handle reopened issues in workflow
This commit is contained in:
parent
bdfc0beb23
commit
c4cf4aa33e
@ -2,7 +2,9 @@ name: Create a new branch and link it back to the issue.
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
create-branch:
|
||||
|
||||
8
main.go
8
main.go
@ -115,8 +115,12 @@ func main() {
|
||||
logger.Printf("Branch '%s' already exists. No action taken.\n", branchName)
|
||||
} else {
|
||||
// Create and push the branch
|
||||
logger.Printf("Creating branch '%s' from 'develop'.\n", branchName)
|
||||
err = runCommand(logger, "git", "checkout", "-b", branchName, "origin/develop")
|
||||
originBranch := "origin/develop"
|
||||
if prefix == "hotfix" {
|
||||
originBranch = "origin/main"
|
||||
}
|
||||
logger.Printf("Creating branch '%s' from '%s'.\n", branchName, originBranch)
|
||||
err = runCommand(logger, "git", "checkout", "-b", branchName, originBranch)
|
||||
if err != nil {
|
||||
logger.Printf("Error while creating the branch: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user