Skip to content

Commit fe67faf

Browse files
committed
fix: zero exit status codes
1 parent 69015af commit fe67faf

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

.autogit-hooks-dev/commit-msg

Lines changed: 0 additions & 5 deletions
This file was deleted.

Taskfile.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ tasks:
6969

7070
hook:dev:
7171
cmds:
72-
- git config --global core.hooksPath $(pwd)/.autogit-hooks-dev
73-
7472
- sudo rm /usr/local/bin/autogit | true
7573

76-
- echo -e '#!/bin/bash\nset -x\nset -e\nfilepath=`pwd`\ncd /home/naa/repos/pet_projects/autogit && AUTOGIT_PROJECT_FOLDER=$filepath go run . $@' | sudo tee /usr/local/bin/autogit
74+
- sudo ln -s {{.PWD}}/docs/dev/autogit /usr/local/bin/autogit
7775
- sudo chmod 777 /usr/local/bin/autogit
7876

77+
- go run . hook activate --global
7978
hook:prod:
8079
cmds:
8180
- sudo rm /usr/local/bin/autogit | true

docs/dev/autogit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -x
3+
set -e
4+
filepath=`pwd`
5+
cd /home/naa/repos/pet_projects/autogit
6+
go build -o autogit ./main.go
7+
AUTOGIT_PROJECT_FOLDER=$filepath ./autogit $@
8+
echo $?

interface_cli/actions/changelog.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ func Changelog(params ChangelogParams, gitw *git.Repository) string {
4747
rendered_changelog := changelogus.Render()
4848

4949
if params.Validate {
50+
var anyError error = nil
51+
5052
log_commits := g.GetChangelogByTag(types.TagName(params.Tag), false)
5153
for _, commit := range log_commits {
5254
err := validation.Validate(commit, conf)
53-
logus.Log.CheckError(err, "failed to validate", logus.Commit(commit.ParsedCommit))
55+
if logus.Log.CheckError(err, "failed to validate", logus.Commit(commit.ParsedCommit)) {
56+
anyError = err
57+
}
5458
}
59+
60+
logus.Log.CheckFatal(anyError, "encountered at least one error during changelog validation")
5561
}
5662

5763
return rendered_changelog

interface_cli/actions/commit_msg.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ func CommmitMsg(args []string) {
3333
logus.Log.Debug("acquired file_content", logus.CommitMessage(fileContent))
3434

3535
commit, err := conventionalcommits.NewCommit(fileContent)
36-
logus.Log.CheckError(err, "unable to parse commit to conventional commits standard")
36+
logus.Log.CheckFatal(err, "unable to parse commit to conventional commits standard")
3737

3838
err = validation.Validate(*commit, conf)
39-
logus.Log.CheckError(err, "failed to validate commits", logus.Commit(commit.ParsedCommit))
39+
logus.Log.CheckFatal(err, "failed to validate commits", logus.Commit(commit.ParsedCommit))
4040

4141
logus.Log.Info("parsed commit", logus.Commit(commit.ParsedCommit))
4242
}

0 commit comments

Comments
 (0)