Skip to content

A section with no markers still runs its updater #695

Description

@Jamie-BitFlight

What happens

src/sections/index.ts guards each section with:

const [startToken, stopToken] = inputs.readmeEditor.getTokenIndexes(section);
if (startToken === -1 || stopToken === -1) {
  return {};
}

getTokenIndexes returns [] when a marker is missing, so both values are undefined and the guard never fires. Every configured section's updater runs whether or not the README has its markers.

Consequence

The README itself is safe, because updateSection finds no markers and writes nothing. The updater's other effects still happen:

  • updateBranding writes the SVG file and logs branding svg successfully created for a README with no branding section.
  • The action's sections output reports content for sections the README does not have.

Related

#644 asks for a warning when a section's markers are missing. This guard is where that check belongs, and today it never runs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

releasedThis issue/pull request has been released.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions