Compare commits

..

13 commits

3 changed files with 2 additions and 17 deletions

View file

@ -31,7 +31,7 @@ func init() {
runCmd.PersistentFlags().StringVar(&flagBranch, "branch", "main", "")
runCmd.PersistentFlags().StringVar(&flagOwner, "owner", "", "")
runCmd.PersistentFlags().StringVar(&flagRepo, "repo", "", "")
runCmd.PersistentFlags().StringVar(&flagExtraFiles, "extra-files", "", "")
runCmd.PersistentFlags().StringVar(&flagRepo, "extra-files", "", "")
}
func run(cmd *cobra.Command, _ []string) error {

View file

@ -277,19 +277,6 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
updatedContent = updater.UpdateContent(updatedContent, nextVersion)
}
err = file.Truncate(0)
if err != nil {
return fmt.Errorf("failed to replace file content: %w", err)
}
_, err = file.Seek(0, 0)
if err != nil {
return fmt.Errorf("failed to replace file content: %w", err)
}
_, err = file.Write([]byte(updatedContent))
if err != nil {
return fmt.Errorf("failed to replace file content: %w", err)
}
_, err = worktree.Add(extraFile)
if err != nil {
return fmt.Errorf("failed to add updated file to git worktree: %w", err)

View file

@ -25,12 +25,10 @@ func (u *GenericUpdater) UpdateContent(content, version string) string {
output.Grow(len(content))
for _, line := range strings.Split(content, "\n") {
if strings.Contains(line, InlineUpdateMarker) {
// We strip the "v" prefix to avoid adding/removing it from the users input.
line = SemVerRegex.ReplaceAllLiteralString(line, strings.TrimPrefix(version, "v"))
line = SemVerRegex.ReplaceAllLiteralString(line, version)
}
output.WriteString(line)
// TODO: Fix added newline
output.WriteByte('\n')
}