Skip to content

Commit

Permalink
Add πŸš€ as a valid prefix for release PRs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Shen <[email protected]>
  • Loading branch information
mjlshen committed Oct 5, 2023
1 parent 482e922 commit 4294805
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ specifying the kind of change:
- Non-breaking feature: :sparkles: (`:sparkles:`)
- Patch fix: :bug: (`:bug:`)
- Docs: :book: (`:book:`)
- Release: :rocket: (`:rocket:`)
- Infra/Tests/Other: :seedling: (`:seedling:`)

See [the document](/VERSIONING.md) for more details.
Expand Down
2 changes: 2 additions & 0 deletions notes/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ var _ = Describe("PR title parsing", func() {
Entry("should match infra from :seedling:", ":seedling: Update Go mod version to 1.15", InfraPR, "Update Go mod version to 1.15"),
Entry("should match infra from πŸƒ(deprecated)", "πŸƒ hack/setup-envtest.sh: follow-up from #1092", InfraPR, "hack/setup-envtest.sh: follow-up from #1092"),
Entry("should match infra from :running: (deprecated)", ":running: Proposal to extract cluster-specifics out of the Manager", InfraPR, "Proposal to extract cluster-specifics out of the Manager"),
Entry("should match release from :rocket:", ":rocket: release v0.0.1", ReleasePR, "release v0.0.1"),
Entry("should match release from πŸš€", "πŸš€ release v0.0.1", ReleasePR, "release v0.0.1"),
Entry("should put anything else as uncategorized", "blah blah", UncategorizedPR, "blah blah"),
)

Expand Down
9 changes: 8 additions & 1 deletion notes/common/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
)

type PRType int

func (t PRType) Emoji() string {
switch t {
case UncategorizedPR:
Expand Down Expand Up @@ -55,7 +56,7 @@ func (t PRType) String() string {
case InfraPR:
return "infra"
default:
panic(fmt.Sprintf("unrecognized PR type %v", t))
panic(fmt.Sprintf("unrecognized PR type %d", int(t)))
}
}

Expand All @@ -66,6 +67,7 @@ const (
BugfixPR
DocsPR
InfraPR
ReleasePR
)

// NB(directxman12): These are constants because some folks' dev environments like
Expand All @@ -80,6 +82,7 @@ const (
emojiInfra = string('🌱')
emojiBreaking = string('⚠')
emojiInfraLegacy = string('πŸƒ')
emojiRelease = string('πŸš€')
)

func PRTypeFromTitle(title string) (PRType, string) {
Expand Down Expand Up @@ -111,6 +114,10 @@ func PRTypeFromTitle(title string) (PRType, string) {
title = strings.TrimPrefix(title, ":warning:")
title = strings.TrimPrefix(title, emojiBreaking)
prType = BreakingPR
case strings.HasPrefix(title, ":rocket:"), strings.HasPrefix(title, emojiRelease):
title = strings.TrimPrefix(title, ":rocket:")
title = strings.TrimPrefix(title, emojiRelease)
prType = ReleasePR
case strings.HasPrefix(title, ":running:"), strings.HasPrefix(title, emojiInfraLegacy):
// This has been deprecated in favor of :seedling:
title = strings.TrimPrefix(title, ":running:")
Expand Down
3 changes: 2 additions & 1 deletion verify/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ You need to have one of these as the prefix of your PR title:
- Non-breaking feature: ✨ (%#q)
- Patch fix: πŸ› (%#q)
- Docs: πŸ“– (%#q)
- Release: πŸš€ (%#q)
- Infra/Tests/Other: 🌱 (%#q)
More details can be found at [sigs.k8s.io/kubebuilder-release-tools/VERSIONING.md](https://sigs.k8s.io/kubebuilder-release-tools/VERSIONING.md).`,
e.title, ":warning:", ":sparkles:", ":bug:", ":book:", ":seedling:")
e.title, ":warning:", ":sparkles:", ":bug:", ":book:", ":rocket:", ":seedling:")
}

// verifyPRType checks that the PR title contains a prefix that defines its type
Expand Down

0 comments on commit 4294805

Please sign in to comment.