Skip to content

Commit

Permalink
infra[patch]: Sanitize body in spam filter (#6642)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnaneKhan authored Aug 27, 2024
1 parent 160c83c commit 3f9d6a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/spam-comment-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:
node-version: 18.x
- name: Check issue body against regex
id: regex_check
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
REGEX='^download\s+(?:https?:\/\/)?[\w-]+(\.[\w-]+)+[^\s]+\s+password:\s*.+\s+in the installer menu, select\s*.+$'
if echo "${{ github.event.comment.body }}" | tr '\n' ' ' | grep -qiP "$REGEX"; then
if echo "$COMMENT_BODY" | tr '\n' ' ' | grep -qiP "$REGEX"; then
echo "REGEX_MATCHED=true" >> $GITHUB_OUTPUT
else
echo "REGEX_MATCHED=false" >> $GITHUB_OUTPUT
Expand All @@ -38,4 +40,4 @@ jobs:
COMMENT_ID: ${{ github.event.comment.id }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
run: cd ./libs/langchain-scripts && yarn filter_spam_comment
run: cd ./libs/langchain-scripts && yarn filter_spam_comment

0 comments on commit 3f9d6a2

Please sign in to comment.