Skip to content

fix: parse commands with CRLF line endings - #108

Draft
thc1006 wants to merge 1 commit into
cncf:mainfrom
thc1006:fix/crlf-command-parsing
Draft

fix: parse commands with CRLF line endings#108
thc1006 wants to merge 1 commit into
cncf:mainfrom
thc1006:fix/crlf-command-parsing

Conversation

@thc1006

@thc1006 thc1006 commented Aug 27, 2026

Copy link
Copy Markdown

Description

getCommandArgs and getLineArgs split the comment body on \n but never strip the \r, so with a CRLF comment every line except the last keeps a trailing carriage return. /kind enhancement\r is then filtered out because enhancement\r is not an allowed label, /milestone ...\r misses the milestone by name, and only the final line, which has no \r, works.

That is exactly #81: /kind, /milestone, and /area only took effect on whichever command was on the last line, and reordering changed which one worked. GitHub delivers comment bodies with CRLF, so this hits any comment with more than one command.

This normalizes \r\n and a lone \r to \n before splitting, through a small splitLines helper used by both functions.

Fixes #81

Testing

  • npm run all passes (build, lint, pack, test)
  • a CRLF comment with /kind and /area returns each command's args without a trailing carriage return
  • getLineArgs returns a milestone title with no trailing carriage return
  • confirmed both tests fail without the change

Checklist:

  • I ran npm run all to lint and build my code
  • No new dependencies
  • I have performed a self review of my own code
  • I have commented my code, particularly in hard to understand areas
  • I have made corresponding changes to the documentation (no documentation changes needed)
  • My changes generate no new warnings

getCommandArgs and getLineArgs split the body on \n without stripping
the \r, so a CRLF comment left a trailing carriage return on every line
but the last. Commands other than the last then failed their label or
milestone lookup. Normalize \r\n and a lone \r to \n before splitting.

Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
@thc1006
thc1006 requested a review from jpmcb as a code owner August 27, 2026 09:57
@thc1006
thc1006 marked this pull request as draft August 27, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] When the tags are used together, an error is reported

1 participant