feat: support branch creation from 'main' for hotfixes and handle reopened issues in workflow

This commit is contained in:
Mandresy RABENJAHARISON 2025-09-29 17:01:50 +03:00
parent bdfc0beb23
commit c4cf4aa33e
2 changed files with 9 additions and 3 deletions

View File

@ -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:

View File

@ -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)