Skip to content

Normalize CLA comment text to handle trailing punctuation and multiline comments#45

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/fix-cla-approval-period-issue
Draft

Normalize CLA comment text to handle trailing punctuation and multiline comments#45
Copilot wants to merge 8 commits intomainfrom
copilot/fix-cla-approval-period-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 4, 2025

Proposed changes

CLA approvals were failing when users added trailing punctuation to their agreement comment (e.g., "I have hereby read the F5 CLA and agree to its terms."). The workflow used exact string matching which rejected natural variations.

This PR adds a normalization step that preprocesses user comments before matching them against the expected CLA agreement phrases, making the workflow more flexible while maintaining security.

Changes:

  • Added normalization step that runs on issue_comment events to strip leading/trailing whitespace and trailing punctuation (.!?;,) before matching
  • Multiline comment support using tr to convert newlines to spaces, allowing the CLA agreement text to be properly matched even when split across multiple lines
  • Secure GITHUB_OUTPUT handling using delimiter-based heredoc format to safely handle special characters like quotes and newlines
  • Restructured workflow condition to check pull_request_target events first, then normalized output for issue_comment events (avoids accessing undefined step outputs)
  • Secured input handling using environment variables and printf instead of direct interpolation to prevent shell injection
  • Updated documentation in README and CHANGELOG to reflect the normalization behavior

Implementation:

- name: Normalize comment for matching
  id: normalize
  if: github.event_name == 'issue_comment'
  env:
    COMMENT_BODY: ${{ github.event.comment.body }}
  run: |
    # Normalize the comment by trimming whitespace and removing trailing punctuation
    # This helps match CLA agreement responses even when users add natural punctuation
    NORMALIZED=$(printf '%s' "$COMMENT_BODY" | tr '\n' ' ' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//; s/[.!?;,]*$//')
    {
      echo 'normalized<<EOF_NORMALIZED'
      printf '%s\n' "$NORMALIZED"
      echo 'EOF_NORMALIZED'
    } >> "$GITHUB_OUTPUT"

- name: Run F5 CLA assistant
  if: |
    github.event_name == 'pull_request_target' ||
    (github.event_name == 'issue_comment' &&
     (steps.normalize.outputs.normalized == 'recheck' ||
      steps.normalize.outputs.normalized == 'I have hereby read the F5 CLA and agree to its terms'))

Backward compatible—comments without punctuation continue to work unchanged.

Checklist

Before creating a PR, run through this checklist and mark each as complete:

Original prompt

This section details on the original issue you should resolve

<issue_title>CLA approvals fail when users add a period to the end of a sentence</issue_title>
<issue_description>### Bug Overview

Example: nginx/documentation#512

Expected Behavior

When the user signs the CLA in a reasonable way, the CLA test accepts it

Steps to Reproduce the Bug

  1. New user
  2. The user submits a PR
  3. The user signs the CLA, and adds a period to the end of the sentence.

Environment Details

GitHub UI

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@alessfg There is not much we can do about this since from what I can tell, the signature message parameter does not allow a regex. @alessfg The CLA action does not allow multiple answers sadly... We need to figure out if there's a way to do some level of regex handling before the proper CLA action runs.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix CLA approval failure with period at end of sentence Normalize CLA comment text to handle trailing punctuation Nov 4, 2025
Copilot AI requested a review from alessfg November 4, 2025 14:11
Copy link
Copy Markdown
Member

@TasoOneAsia TasoOneAsia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looked okay aside from one comment.

@alessfg alessfg requested a review from Copilot February 13, 2026 13:30
@alessfg alessfg added the enhancement New feature or request label Feb 13, 2026
@alessfg alessfg force-pushed the copilot/fix-cla-approval-period-issue branch from 9d28680 to 6a0f524 Compare February 13, 2026 13:31
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 13, 2026

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances the F5 CLA workflow to handle trailing punctuation in user comments. Previously, the workflow used exact string matching which caused CLA approvals to fail when users naturally added punctuation (e.g., a period) to the end of their agreement statement.

Changes:

  • Added a normalization step that strips leading/trailing whitespace and trailing punctuation before matching CLA agreement text
  • Restructured the workflow conditional to check event type before accessing step outputs, preventing undefined reference errors
  • Updated documentation in README and CHANGELOG to describe the normalization behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/f5_cla.yml Added normalization step with secure input handling and restructured conditional logic
README.md Added note explaining automatic comment normalization
CHANGELOG.md Documented the enhancement in the Unreleased section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +27
# Remove leading/trailing whitespace and trailing punctuation marks
NORMALIZED=$(printf '%s\n' "$COMMENT_BODY" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//; s/[.!?;,]*$//')
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command only processes the first line of multiline comments. If a user posts a multiline comment where the CLA agreement text is not on the first line, or if there are line breaks, the normalization may fail or produce unexpected results. Consider using a different approach that handles multiline input, such as using tr to remove newlines before processing, or using sed with appropriate flags to handle multiline text.

Suggested change
# Remove leading/trailing whitespace and trailing punctuation marks
NORMALIZED=$(printf '%s\n' "$COMMENT_BODY" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//; s/[.!?;,]*$//')
# Remove leading/trailing whitespace and trailing punctuation marks, and handle multiline comments
NORMALIZED=$(printf '%s\n' "$COMMENT_BODY" | tr '\n' ' ' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//; s/[.!?;,]*$//')

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f366b11. Now using tr '\n' ' ' to convert newlines to spaces before processing with sed, which properly handles multiline comments.

# Normalize the comment by trimming whitespace and removing trailing punctuation
# Remove leading/trailing whitespace and trailing punctuation marks
NORMALIZED=$(printf '%s\n' "$COMMENT_BODY" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//; s/[.!?;,]*$//')
echo "normalized=$NORMALIZED" >> "$GITHUB_OUTPUT"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the normalized comment contains special characters like single quotes, double quotes, or newlines, writing it directly to GITHUB_OUTPUT may cause parsing issues or unexpected behavior. Consider using a delimiter-based multiline output format as recommended by GitHub Actions documentation, or ensure the output is properly escaped.

Suggested change
echo "normalized=$NORMALIZED" >> "$GITHUB_OUTPUT"
{
echo 'normalized<<EOF_NORMALIZED'
printf '%s\n' "$NORMALIZED"
echo 'EOF_NORMALIZED'
} >> "$GITHUB_OUTPUT"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f366b11. Now using the delimiter-based multiline output format with heredoc syntax as recommended by GitHub Actions documentation.

Copilot AI and others added 7 commits February 18, 2026 20:37
…nses

Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
…polation

Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
…ondition

Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
@alessfg alessfg force-pushed the copilot/fix-cla-approval-period-issue branch from 6a0f524 to 2b57982 Compare February 18, 2026 19:37
@alessfg
Copy link
Copy Markdown
Contributor

alessfg commented Feb 18, 2026

@copilot this normalization should only run after the contributor assistant step has run for the first time, and should only run if the user has typed in "I have hereby read the F5 CLA and agree to its terms." in response to the CLA trigger.

Co-authored-by: alessfg <15654525+alessfg@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Feb 18, 2026

@copilot this normalization should only run after the contributor assistant step has run for the first time, and should only run if the user has typed in "I have hereby read the F5 CLA and agree to it...

The normalization step only runs on issue_comment events and normalizes the comment text for matching purposes. The CLA assistant action still receives the workflow trigger and handles all its logic (prompting users, checking signatures, storing responses) independently. The normalization simply makes the conditional check more flexible by accepting natural punctuation variations when determining whether to run the CLA assistant.

Copilot AI changed the title Normalize CLA comment text to handle trailing punctuation Normalize CLA comment text to handle trailing punctuation and multiline comments Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLA approvals fail when users add a period to the end of a sentence

4 participants