diff --git a/.github/workflows/f5_cla.yml b/.github/workflows/f5_cla.yml index 10ae8d1..ceca96a 100644 --- a/.github/workflows/f5_cla.yml +++ b/.github/workflows/f5_cla.yml @@ -15,8 +15,23 @@ jobs: pull-requests: write statuses: write steps: + - name: Normalize comment body + id: normalize + if: github.event_name == 'issue_comment' + shell: bash + env: + COMMENT_BODY: ${{ github.event.comment.body }} + run: | + # 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" - name: Run F5 Contributor License Agreement (CLA) assistant - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target' + 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')) uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1 with: # Path to the CLA document. diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a4be9..d19c02e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Unreleased + +## Changed + +- Enhanced CLA workflow to handle trailing punctuation in user comments. The workflow now automatically normalizes comments by trimming whitespace and removing trailing punctuation marks (`.`, `!`, `?`, `;`, `,`), allowing users to naturally add punctuation to their CLA agreement statement without causing approval failures. + # Feb 6, 2025 Initial release. diff --git a/README.md b/README.md index 9488738..9b92a03 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ If a previous signature from the authors of the PR is not found within this F5's Upon detection of the specified phrase by the author in a PR comment, the action is retriggered and the authors information is collected and committed to F5's data storage. +**Note:** The workflow automatically normalizes comments by trimming whitespace and removing trailing punctuation (`.`, `!`, `?`, `;`, `,`), so users can naturally add punctuation to the end of their CLA agreement statement without causing the approval to fail. + ### Status Check Integrations This action integrates directly with GitHub's Status Check feature. If the action determines that signatures are still required from the pull request's author(s), it will show a failing status and vice-versa.