Skip to content

Commit

Permalink
Merge pull request #51 from minnek-digital-studio/release/2.5.0
Browse files Browse the repository at this point in the history
release/2.5.0 master
  • Loading branch information
Isaac Martinez authored Mar 12, 2023
2 parents 57ad6fd + dbe75ec commit 42c346f
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ sudo apt install git-flow

1. Download installer

[![Macos](https://img.shields.io/badge/mac%20os-0078D6?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.4.0.dmg) [![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white
)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.4.0.exe) [![Linux](https://img.shields.io/badge/Linux-0078D6?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.4.0.deb)
[![Macos](https://img.shields.io/badge/mac%20os-0078D6?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.5.0.dmg) [![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white
)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.5.0.exe) [![Linux](https://img.shields.io/badge/Linux-0078D6?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/Minnek-Digital-Studio/cominnek/releases/latest/download/cominnek-2.5.0.deb)

2. Run installer ([See MAC Os steps](#how-to-install-on-mac))

Expand Down Expand Up @@ -375,7 +375,7 @@ $ cominnek push "Changes in home page" -F "home"
If you want to contribute to this project, please read the [contributing guide](/CONTRIBUTING.md)
Cominnek `V2.4.0`
Cominnek `V2.5.0`
> With ❤ by [isaacismaelx14](https://github.com/isaacismaelx14)
## About
Expand Down
2 changes: 1 addition & 1 deletion assets/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rm -rf ./build/*
mkdir -p ${BUILD_DIR}

go mod tidy;
go build -o ${BUILD_DIR}
go build -o ${BUILD_DIR} -ldflags=-compressdwarf=false

cd ${BUILD_DIR}
dh_make --createorig --copyright gpl3 -e isaac@minnekdigital.com --single -y
Expand Down
2 changes: 1 addition & 1 deletion assets/windows/bin/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#include "environment.iss"
#define MyAppName "Cominnek"
#define MyAppVersion "2.4.0"
#define MyAppVersion "2.5.0"
#define MyAppPublisher "Minnek Digital Studio"
#define MyAppURL "https://github.com/Minnek-Digital-Studio/cominnek"
#define MyAppExeName "cominnek.exe"
Expand Down
6 changes: 6 additions & 0 deletions cmd/update_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ var updateVersion = &cobra.Command{
Use: "update-version <version>",
Short: "Create a commit for update version following conventional commits",
Run: func(cmd *cobra.Command, args []string) {

if len(args) == 0 {
cmd.Help()
return
}

version := args[0]
extras.UpdateVersion(version)
},
Expand Down
2 changes: 1 addition & 1 deletion config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var cominnekPath = filepath.Join(userPath, ".cominnek")
var cominnekTempPath = filepath.Join(tempPath, ".cominnek")

var Public = IConfig{
Version: "v2.4.0",
Version: "v2.5.0",
KeyPath: filepath.Join(cominnekPath, "key.bin"),
TokenPath: filepath.Join(cominnekPath, "auth.bin"),
PRBody: filepath.Join(cominnekPath, "pr-body.md"),
Expand Down
27 changes: 27 additions & 0 deletions controllers/github/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ type NewPullRequest struct {
Draft bool
}

func showExistingPR(prData NewPullRequest) {
client := client()

existing_pr, _, err := client.PullRequests.List(ctx, prData.Owner, prData.Repo, &github.PullRequestListOptions{
State: "open",
Head: prData.Head,
Base: prData.Base,
})

if err != nil {
fmt.Println(err)
return
}

fmt.Println("\nExisting PR:")

for _, pr := range existing_pr {
fmt.Println("\t" + pr.GetHTMLURL())
}
fmt.Println()
}

func CreatePullRequest(prData NewPullRequest) {
loading.Start("Creating pull request ")
client := client()
Expand All @@ -45,6 +67,11 @@ func CreatePullRequest(prData NewPullRequest) {
clearMessageS2 := strings.Replace(clearMessageS1, "]", "", -1)
message := fmt.Sprintf("\t%s", clearMessageS2)
fmt.Println(message)

if strings.Contains(message, "A pull request already exists for") {
showExistingPR(prData)
}

os.Exit(1)
}

Expand Down
15 changes: 15 additions & 0 deletions pkg/cli/actions/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ func executeCommit() {
func Commit(exec bool) {
raw := []string{}
list := []string{}
currentBranch := git_controller.GetCurrentBranch()

if strings.HasPrefix(currentBranch, "bugfix/") {
config.Public.Commits.Types = []string{
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"ci",
"chore",
"revert",
}
}

if !config.AppData.Commit.AddAll {
loading.Start("Checking files status ")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/actions/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func prQuestions() {
func PullRequest() {
prQuestions()

github.CreatePullRequest(config.AppData.PullRequest.Ticket, config.AppData.PullRequest.Base)
github.NewCreatePullRequest(config.AppData.PullRequest.Ticket, config.AppData.PullRequest.Base)
}
12 changes: 12 additions & 0 deletions pkg/git/Commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
git_controller "github.com/Minnek-Digital-Studio/cominnek/controllers/git"
"github.com/Minnek-Digital-Studio/cominnek/controllers/loading"
"github.com/Minnek-Digital-Studio/cominnek/pkg/shell"
"github.com/fatih/color"
)

func _commit(msg string, body string, ctype string, scope string, ticket string) string {
Expand Down Expand Up @@ -49,6 +50,17 @@ func _checkTicket(ticket string) string {

func Commit(msg string, body string, ctype string, scope string) {
loading.Start("Commiting files ")
currentBranch := git_controller.GetCurrentBranch()

if strings.HasPrefix(currentBranch, "bugfix/") {
if ctype == "feat" {
loading.Stop()
color.HiRed("Error:")
log.Fatal("Bugfix branch cannot have a feature commit")
os.Exit(1)
}
}

ticket := _checkTicket(git_controller.GetTicketNumber())
out := _commit(msg, body, ctype, scope, ticket)

Expand Down
4 changes: 2 additions & 2 deletions pkg/github/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func _checkBranch() []string {
return branch
}

func _createPullRequest(ticket string, baseBranch string) {
func NewCreatePullRequest(ticket string, baseBranch string) {
loading.Start("Checking branch ")
branchs := _checkBranch()
loading.Stop()
Expand All @@ -41,6 +41,6 @@ func _createPullRequest(ticket string, baseBranch string) {

func Publish(ticket string) {
git.PushPublish()
_createPullRequest(ticket, "")
NewCreatePullRequest(ticket, "")
log.Println("Publish complete")
}

0 comments on commit 42c346f

Please sign in to comment.