-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate between label-filter and release labels
Partially reverts the behavior change introduced by #238. Filtering is still done in the changelog generation, but now we store all of the PR labels in the release-state and return to filtering against all the PR labels using --label-filter. The newly introduced behavior in #238 is now part of the new --release-labels flag, which configures the release-labels to use when generating release notes. Signed-off-by: Chance Zibolski <[email protected]>
- Loading branch information
1 parent
1e54a17
commit e6967d5
Showing
7 changed files
with
66 additions
and
7 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
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,15 @@ | ||
package changelog | ||
|
||
import "slices" | ||
|
||
func filterByLabels(labels []string, filters []string) bool { | ||
if len(filters) == 0 { | ||
return true | ||
} | ||
for _, label := range labels { | ||
if slices.Contains(filters, label) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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,15 @@ | ||
package changelog | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_filterByLabels(t *testing.T) { | ||
assert.True(t, filterByLabels([]string{"label-a", "label-b", "label-c"}, []string{})) | ||
assert.True(t, filterByLabels([]string{"label-a", "label-b", "label-c"}, []string{"label-a"})) | ||
assert.True(t, filterByLabels([]string{"label-a", "label-b", "label-c"}, []string{"label-b"})) | ||
assert.True(t, filterByLabels([]string{"label-a", "label-b", "label-c"}, []string{"label-c"})) | ||
assert.False(t, filterByLabels([]string{"label-a", "label-b", "label-c"}, []string{"label-d"})) | ||
} |
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