code: func (Pipe) Run(ctx *context.Context) error {
  	// TODO: should probably have a different field for the filename and its
  	// contents.
  	if ctx.ReleaseNotes != "" {
  		notes, err := loadFromFile(ctx.ReleaseNotes)
  		if err != nil {
  			return err
  		}
  		ctx.ReleaseNotes = notes
  	}
  	if ctx.Config.Changelog.Skip {
  		return pipe.Skip("changelog should not be built")
  	}
  	if ctx.Snapshot {
  		return pipe.Skip("not available for snapshots")
  	}
  	if ctx.ReleaseNotes != "" {
  		return nil
  	}
  	if err := checkSortDirection(ctx.Config.Changelog.Sort); err != nil {
  		return err
  	}
  	entries, err := buildChangelog(ctx)
  	if err != nil {
  		return err
  	}
  	ctx.ReleaseNotes = fmt.Sprintf("## Changelog\n\n%v\n", strings.Join(entries, "\n"))
  	var path = filepath.Join(ctx.Config.Dist, "CHANGELOG.md")
  	log.WithField("changelog", path).Info("writing")
  	return ioutil.WriteFile(path, []byte(ctx.ReleaseNotes), 0644)
  }
docs: // Run the pipe