feat: add skip_if_no_notes_file setting

This commit is contained in:
RaviAnand Mohabir 2024-06-25 15:29:33 +02:00
parent 8a5a2b85cf
commit 3509a5c98f

View File

@ -35,6 +35,7 @@ type Args struct {
NotesFile string `envconfig:"PLUGIN_NOTES_FILE"`
Notes string `envconfig:"PLUGIN_NOTES"`
IsPrerelease bool `envconfig:"PLUGIN_IS_PRERELEASE"`
SkipIfNoNotesFile bool `envconfig:"PLUGIN_SKIP_IF_NO_NOTES_FILE"`
}
type TitleTemplateCtx struct {
@ -60,6 +61,10 @@ func Exec(ctx context.Context, args Args) error {
content, err := os.ReadFile(args.NotesFile)
if err != nil {
if os.IsNotExist(err) && args.SkipIfNoNotesFile {
fmt.Println("No notes file found, skipping release")
return nil
}
return fmt.Errorf("error reading notes file %w", err)
}