Skip to content

Commit

Permalink
schedule-builder: Add markdown help
Browse files Browse the repository at this point in the history
Add a help section of top of each markdown file to describe how the file
is being generated.

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Apr 23, 2024
1 parent 2fcf8f0 commit 78ae01c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/schedule-builder/cmd/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ func processFile(fileName string, vars interface{}) string {
const (
refDate = "2006-01-02"
refDateMonthly = "January 2006"
markdownHelp = `# Use "schedule-builder" to maintain this file:
# https://github.com/kubernetes/release/tree/master/cmd/schedule-builder
# For example by running:
# schedule-builder -uc data/releases/schedule.yaml -e data/releases/eol.yaml
---
`
)

func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches EolBranches, filePath, eolFilePath string) error {
Expand Down Expand Up @@ -311,6 +317,7 @@ func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches
if err != nil {
return fmt.Errorf("marshal schedule YAML: %w", err)
}
yamlBytes = append([]byte(markdownHelp), yamlBytes...)

//nolint:gocritic,gosec
if err := os.WriteFile(filePath, yamlBytes, 0o644); err != nil {
Expand All @@ -324,6 +331,7 @@ func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches
if err != nil {
return fmt.Errorf("marshal end of life YAML: %w", err)
}
yamlBytes = append([]byte(markdownHelp), yamlBytes...)

//nolint:gocritic,gosec
if err := os.WriteFile(eolFilePath, yamlBytes, 0o644); err != nil {
Expand Down

0 comments on commit 78ae01c

Please sign in to comment.