Skip to content

Commit

Permalink
Update to only use auto-generate if no env / -c commit hash is found
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgHaj committed Nov 21, 2024
1 parent 636856c commit ab210af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ If the given path contains a git repository all flags but "integration" will be

cmd.Flags().StringVarP(&repositoryName, RepositoryFlag, "r", "", "repository name")
cmd.Flags().StringVarP(&commitName, CommitFlag, "c", "", "commit hash")
cmd.Flags().BoolVar(&generateCommitNameBool, GenerateCommitName, false, "auto-generate a commit name if flag is set")
cmd.Flags().BoolVar(&generateCommitNameBool, GenerateCommitName, false, "auto-generate a commit name if no commit hash is found (in -c or env)")
cmd.Flags().StringVarP(&branchName, BranchFlag, "b", "", "branch name")
cmd.Flags().StringVarP(&commitAuthor, CommitAuthorFlag, "a", "", "commit author")
cmd.Flags().StringVarP(&repositoryUrl, RepositoryUrlFlag, "u", "", "repository URL")
Expand Down
10 changes: 5 additions & 5 deletions internal/scan/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ func (dScanner *DebrickedScanner) Scan(o IOptions) error {

e, _ := dScanner.ciService.Find()

if dOptions.GenerateCommitName {
debug.Log("Overwriting commit name with generated name", dOptions.Debug)
dOptions.CommitName = GenerateCommitNameTimestamp()
}

debug.Log("Mapping environment variables...", dOptions.Debug)
MapEnvToOptions(&dOptions, e)

if dOptions.GenerateCommitName && dOptions.CommitName == "" {
debug.Log("No commit name set, generating commit name", dOptions.Debug)
dOptions.CommitName = GenerateCommitNameTimestamp()
}

if err := SetWorkingDirectory(&dOptions); err != nil {
return err
}
Expand Down

0 comments on commit ab210af

Please sign in to comment.