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:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened]
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-branch:
|
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)
|
logger.Printf("Branch '%s' already exists. No action taken.\n", branchName)
|
||||||
} else {
|
} else {
|
||||||
// Create and push the branch
|
// Create and push the branch
|
||||||
logger.Printf("Creating branch '%s' from 'develop'.\n", branchName)
|
originBranch := "origin/develop"
|
||||||
err = runCommand(logger, "git", "checkout", "-b", branchName, "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 {
|
if err != nil {
|
||||||
logger.Printf("Error while creating the branch: %v\n", err)
|
logger.Printf("Error while creating the branch: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user