From 3fd152d1b54697d08f6d8763ffef6a801b8779af Mon Sep 17 00:00:00 2001 From: bracesproul Date: Mon, 26 Aug 2024 11:27:18 -0700 Subject: [PATCH 1/2] infra[patch]: Improve speeds for spam detection script --- .github/workflows/spam-comment-filter.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spam-comment-filter.yml b/.github/workflows/spam-comment-filter.yml index bb2db6677de6..2dea8449354a 100644 --- a/.github/workflows/spam-comment-filter.yml +++ b/.github/workflows/spam-comment-filter.yml @@ -16,9 +16,9 @@ jobs: with: node-version: 18.x - name: Install dependencies - run: yarn install --immutable + run: cd ./libs/langchain-scripts && yarn workspaces focus - name: Build scripts - run: yarn turbo:command build --filter=@langchain/scripts + run: cd ./libs/langchain-scripts && yarn build:internal - name: Run spam detection script env: SPAM_COMMENT_GITHUB_TOKEN: ${{ secrets.SPAM_COMMENT_GITHUB_TOKEN }} @@ -26,4 +26,4 @@ jobs: COMMENT_ID: ${{ github.event.comment.id }} REPO_OWNER: ${{ github.repository_owner }} REPO_NAME: ${{ github.event.repository.name }} - run: yarn workspace @langchain/scripts filter_spam_comment \ No newline at end of file + run: cd ./libs/langchain-scripts && yarn filter_spam_comment \ No newline at end of file From bb3ffbc1ac3fa9eacfed80643ec5336d87c67d10 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Mon, 26 Aug 2024 11:28:44 -0700 Subject: [PATCH 2/2] add regex check first --- .github/workflows/spam-comment-filter.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/spam-comment-filter.yml b/.github/workflows/spam-comment-filter.yml index 2dea8449354a..b96f08f5896a 100644 --- a/.github/workflows/spam-comment-filter.yml +++ b/.github/workflows/spam-comment-filter.yml @@ -15,11 +15,23 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x + - name: Check issue body against regex + id: regex_check + run: | + REGEX='^download\s+(?:https?:\/\/)?[\w-]+(\.[\w-]+)+[^\s]+\s+password:\s*.+\s+in the installer menu, select\s*.+$' + if echo "${{ github.event.comment.body }}" | grep -qiE "$REGEX"; then + echo "REGEX_MATCHED=true" >> $GITHUB_OUTPUT + else + echo "REGEX_MATCHED=false" >> $GITHUB_OUTPUT + fi - name: Install dependencies + if: steps.regex_check.outputs.REGEX_MATCHED == 'true' run: cd ./libs/langchain-scripts && yarn workspaces focus - name: Build scripts + if: steps.regex_check.outputs.REGEX_MATCHED == 'true' run: cd ./libs/langchain-scripts && yarn build:internal - name: Run spam detection script + if: steps.regex_check.outputs.REGEX_MATCHED == 'true' env: SPAM_COMMENT_GITHUB_TOKEN: ${{ secrets.SPAM_COMMENT_GITHUB_TOKEN }} COMMENT_JSON: ${{ toJson(github.event.comment) }}