From c4cf4aa33eff3c446cd8049aec439e4d51a477a8 Mon Sep 17 00:00:00 2001 From: Mandresy RABENJAHARISON Date: Mon, 29 Sep 2025 17:01:50 +0300 Subject: [PATCH] feat: support branch creation from 'main' for hotfixes and handle reopened issues in workflow --- ...e the Corresponding Branch of the New Odoo Ticket.yaml | 4 +++- main.go | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/Create the Corresponding Branch of the New Odoo Ticket.yaml b/.gitea/workflows/Create the Corresponding Branch of the New Odoo Ticket.yaml index 4ce2397..eb335bb 100644 --- a/.gitea/workflows/Create the Corresponding Branch of the New Odoo Ticket.yaml +++ b/.gitea/workflows/Create the Corresponding Branch of the New Odoo Ticket.yaml @@ -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: diff --git a/main.go b/main.go index 45f9509..36b1653 100644 --- a/main.go +++ b/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)