generated from fallion/go-template
-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously Revert commits would fail the pipeline as they were not considered conventional commit friendly. This caused issues in multiple projects as commitsar checks would just be ignored. Closes #434
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package text | ||
|
||
import "strings" | ||
|
||
func IsRevertCommit(commitMessage string) bool { | ||
if strings.HasPrefix(commitMessage, "Revert") { | ||
return true | ||
} | ||
|
||
return strings.HasPrefix(commitMessage, "revert") | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package text | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsRevertCommit(t *testing.T) { | ||
tests := map[string]bool{ | ||
"Revert some commit": true, | ||
"revert \"some commit\"": true, | ||
"chore: something\n": false, | ||
"fix: test": false, | ||
"fix: Kodiak style regex": false, | ||
} | ||
|
||
for test, expected := range tests { | ||
err := IsRevertCommit(test) | ||
assert.Equal(t, expected, err) | ||
} | ||
} |
159cec8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: