This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tillLatest := false | |
if latestTag != nil { | |
if latestTag.Hash().String() == repo.ref.Hash().String() { | |
tillLatest = false | |
} else { | |
tillLatest = true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isCommitToNearestTag(repo *git.Repository, commit *object.Commit, tillLatest bool) bool { | |
latestTag, previousTag, err := utils.GetLatestTagFromRepository(repo) | |
if err != nil { | |
log.Fatal("Couldn't get latest tag...", err) | |
} | |
if err != nil { | |
log.Fatal("Couldn't access tag...", err) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IsCommitNearest will check if a commit tag Hash is equal to the current repository HEAD tag | |
// If the Hashes matches, it will return true | |
func (r *Repository) IsCommitNearest(commit *object.Commit) (bool, error) { | |
latestTag, previousTag, err := r.GetLatestTag() | |
if err != nil { | |
return false, fmt.Errorf("%v:%w", "Couldn't get latest tag...", err) | |
} | |
if latestTag != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package logcategory | |
// LogsByCategory - Type to hold logs by each's category | |
type LogsByCategory struct { | |
CI []string | |
FIX []string | |
REFACTOR []string | |
FEATURE []string | |
DOCS []string | |
OTHER []string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// printCategory will output all items inside a Log slice and a title | |
func printCategory(output *strings.Builder, title string, logs []string) { | |
if len(logs) > 0 { | |
output.WriteString(fmt.Sprintf("\n\n## %s \n", title)) | |
for _, item := range logs { | |
output.WriteString(item + "\n") | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GenerateMarkdown - Generate markdown output for the collected commits | |
func (logContainer *LogsByCategory) GenerateMarkdown() string { | |
var output strings.Builder | |
output.WriteString("# Changelog \n") | |
printCategory(&output, "CI Changes", logContainer.CI) | |
printCategory(&output, "Fixes", logContainer.FIX) | |
printCategory(&output, "Performance Fixes", logContainer.REFACTOR) | |
printCategory(&output, "Feature Fixes", logContainer.FEATURE) | |
printCategory(&output, "Doc Updates", logContainer.DOCS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AddCommitLog will take a commitHash and a commitMessage and append them to their | |
// apropriate Slice | |
func (logContainer *LogsByCategory) AddCommitLog(commitHash, commitMessage string) { | |
message := fmt.Sprintf("%s - %s", commitHash, normalizeCommit(commitMessage)) | |
switch { | |
case strings.Contains(commitMessage, "ci:"): | |
logContainer.CI = append(logContainer.CI, message) | |
case strings.Contains(commitMessage, "fix:"): | |
logContainer.FIX = append(logContainer.FIX, message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type StreamClientInterceptor func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) | |
type StreamServerInterceptor func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error | |
type UnaryClientInterceptor func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error | |
type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interceptors | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"google.golang.org/grpc" | |
"google.golang.org/grpc/metadata" | |
) |