Skip to content

bug: pull-request-header and pull-request-footer set to "" fall back to defaults due to || instead of ?? #2696

@mdrxy

Description

@mdrxy

Bug

Setting "pull-request-header": "" in release-please-config.json does not remove the default header. The PR body still contains :robot: I have created a release *beep* *boop*.

Root cause

In src/util/pull-request-body.ts, the constructor uses || for both header and footer:

this.header = options?.header || DEFAULT_HEADER;
this.footer = options?.footer || DEFAULT_FOOTER;

Since empty string is falsy in JavaScript, "" || DEFAULT_HEADER evaluates to DEFAULT_HEADER. These should use nullish coalescing (??) to only fall back for null/undefined:

this.header = options?.header ?? DEFAULT_HEADER;
this.footer = options?.footer ?? DEFAULT_FOOTER;

Steps to reproduce

  1. Set "pull-request-header": "" and/or "pull-request-footer": "" in release-please-config.json
  2. Run release-please to create/update a release PR
  3. Observe the PR body still contains the default header/footer

Expected behavior

An empty string should be respected as an intentional override, producing no header/footer.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions