-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(github): squash commits done by github broken
The way github auto squash formats messages would break the relase notes. Closes #299
- Loading branch information
Showing
8 changed files
with
52 additions
and
33 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ dist | |
testdata/* | ||
!testdata/*.bundle | ||
!testdata/setup_test_repos.sh | ||
.idea | ||
.idea | ||
testrepo |
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
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
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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
package text | ||
|
||
import ( | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
var messageRegex = regexp.MustCompile("^.*\n") | ||
|
||
// TrimMessage returns only the first line of commit message | ||
func TrimMessage(message string) string { | ||
match := messageRegex.FindString(message) | ||
match := strings.Split(message, "\n") | ||
|
||
match = strings.Replace(match, "\n", "", 1) | ||
final := strings.TrimRight(match[0], " ") | ||
|
||
return match | ||
return final | ||
} |
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,21 @@ | ||
package text | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTrimMessage(t *testing.T) { | ||
testset := map[string]string{ | ||
"ci: sometest \n": "ci: sometest", | ||
"ci: sometest\n": "ci: sometest", | ||
"chore: some github message\n some more text here": "chore: some github message", | ||
"chore: someother thing": "chore: someother thing", | ||
} | ||
|
||
for input, expected := range testset { | ||
assert.Equal(t, expected, TrimMessage(input)) | ||
} | ||
|
||
} |
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