From 2cb5bfbdc5592c5268ad38b51a6ed59864166f47 Mon Sep 17 00:00:00 2001 From: ImSwordQueen <52015098+ImSwordQueen@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:14:39 +0100 Subject: [PATCH] I hate case sensitivityyyyyyyyyyyyyyyyyyyyy --- .github/workflows/issue-check.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/issue-check.yml b/.github/workflows/issue-check.yml index fe04856..e1c58ff 100644 --- a/.github/workflows/issue-check.yml +++ b/.github/workflows/issue-check.yml @@ -15,16 +15,23 @@ jobs: id: check_keywords run: | # Define the list of keywords - keywords=("Virus" "Malware" "Windows Defender" "Antivirus" "bitdefender" "defender" "kaspersky" "unwanted" "unwanted" "harmful") + keywords=("Virus" "Malware" "Windows Defender" "Antivirus" "bitdefender" "defender" "kaspersky" "unwanted" "harmful") # Get the issue title and body from the event context ISSUE_TITLE="${{ github.event.issue.title }}" ISSUE_BODY="${{ github.event.issue.body }}" + # Convert both title and body to lowercase for case-insensitive comparison + ISSUE_TITLE_LOWER=$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]') + ISSUE_BODY_LOWER=$(echo "$ISSUE_BODY" | tr '[:upper:]' '[:lower:]') + # Check if any of the keywords are present in the title or body for keyword in "${keywords[@]}"; do - if [[ "$ISSUE_TITLE" == *"$keyword"* ]] || [[ "$ISSUE_BODY" == *"$keyword"* ]]; then - echo "'$keyword'" + # Convert the keyword to lowercase as well + KEYWORD_LOWER=$(echo "$keyword" | tr '[:upper:]' '[:lower:]') + + if [[ "$ISSUE_TITLE_LOWER" == *"$KEYWORD_LOWER"* ]] || [[ "$ISSUE_BODY_LOWER" == *"$KEYWORD_LOWER"* ]]; then + echo "'$keyword' found" echo "contains_keyword=true" >> $GITHUB_ENV break fi @@ -38,10 +45,7 @@ jobs: # Post a comment on the issue curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -d '{"body": "Bum behavior. Closed - i want to know - if these will be separate - or not"}' \ + -d '{"body": "Bum behavior. Closed"}' \ "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments" # Close the issue