Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to skip printing summary header #242

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/changelog/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type ChangeLogConfig struct {
StateFile string
LabelFilters []string
ExcludePRReferences bool
SkipHeader bool
}

func (cfg *ChangeLogConfig) Sanitize() error {
Expand Down Expand Up @@ -67,6 +68,7 @@ func Command(ctx context.Context, logger *log.Logger) *cobra.Command {
cmd.Flags().StringVar(&cfg.RepoName, "repo", "cilium/cilium", "GitHub organization and repository names separated by a slash")
cmd.Flags().StringArrayVar(&cfg.LabelFilters, "label-filter", []string{}, "Filter pull requests by labels. This also defines the order of the release notes.")
cmd.Flags().BoolVar(&cfg.ExcludePRReferences, "exclude-pr-references", false, "If true, do not include references to the PR or PR author")
cmd.Flags().BoolVar(&cfg.SkipHeader, "skip-header", false, "If true, do not print 'Summary of of changes' header")

for _, flag := range []string{"base", "head", "repo"} {
cobra.MarkFlagRequired(cmd.Flags(), flag)
Expand Down
6 changes: 4 additions & 2 deletions cmd/changelog/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ func GenerateReleaseNotes(globalCtx context.Context, ghClient *gh.Client, logger
}

func (cl *ChangeLog) PrintReleaseNotesForWriter(w io.Writer) {
fmt.Fprintln(w, "Summary of Changes")
fmt.Fprintln(w, "------------------")
if !cl.SkipHeader {
fmt.Fprintln(w, "Summary of Changes")
fmt.Fprintln(w, "------------------")
}

listOfPRs := cl.listOfPrs.DeepCopy()
prsWithUpstream := cl.prsWithUpstream.DeepCopy()
Expand Down
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func addFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&cfg.ForceMovePending, "force-move-pending-backports", false, "Force move pending backports to the next version's project")
cmd.Flags().StringArrayVar(&cfg.LabelFilters, "label-filter", []string{}, "Filter pull requests by labels")
cmd.Flags().BoolVar(&cfg.ExcludePRReferences, "exclude-pr-references", false, "If true, do not include references to the PR or PR author")
cmd.Flags().BoolVar(&cfg.SkipHeader, "skip-header", false, "If true, do not print 'Summary of of changes' header")
}

func signals() {
Expand Down