name: MSHUWAP Issue Handler on: issues: types: [opened] # Triggers when an issue is opened jobs: check_keywords: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Check for keywords in issue title and body id: check_keywords run: | # Define the list of keywords 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 # 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 done - name: Comment and close issue if keyword found if: env.contains_keyword == 'true' # Only run if a keyword was found run: | ISSUE_NUMBER="${{ github.event.issue.number }}" # Define the body of the comment with Markdown formatting COMMENT_BODY="[Verse 1] They told him, "Don\'t you ever come around here Don\'t wanna see your face, you better disappear" The fire\'s in their eyes and their words are really clear So beat it, just beat it (Ooh!) You better run, you better do what you can (Ooh!) Don\'t wanna see no blood, don\'t be a macho man (Ooh!) You wanna be tough, better do what you can So beat it, but you wanna be bad [Chorus] Just beat it (Beat it), beat it (beat it) No one wants to be defeated Show them how funky and strong is your fight It doesn\'t matter who\'s wrong or right Just beat it (Beat it) Just beat it (Beat it) Just beat it (Beat it) Just beat it (Beat it, ooh) [Verse 2] They\'re out to get you, better leave while you can Don\'t wanna be a boy, you wanna be a man You wanna stay alive, better do what you can So beat it, just beat it (Ooh!) You have to show them that you\'re really not scared (Ooh!) You\'re playin\' with your life, this ain\'t no truth or dare (Ooh!) They\'ll kick you, then they\'ll beat you, then they\'ll tell you it\'s fair So beat it, but you wanna be bad [Chorus] Just beat it (Beat it), beat it (beat it) No one wants to be defeated Show them how funky and strong is your fight It doesn\'t matter who\'s wrong or right Just beat it (Beat it), beat it (beat it) No one wants to be defeated Showin\' how funky and strong is your fight It doesn\'t matter who\'s wrong or right Just beat it (Beat it, beat it, beat it) Beat it (Beat it, beat it) Beat it (Beat it, beat it) Beat it (Beat it, beat it) [Guitar Solo] [Chorus] Beat it (Beat it), beat it (beat it) No one wants to be defeated Show them how funky and strong is your fight It doesn\'t matter who\'s wrong or right (Who\'s right) Just beat it (Beat it), beat it (beat it) (hoo, hoo!) No one wants to be defeated (Oh, Lord) Show them how funky (Hee-hee!) and strong is your fight (Hee-hee-hee!) It doesn\'t matter who\'s wrong or right Just beat it (Beat it), beat it (beat it) No one wants to be defeated (Oh, no) Show them how funky (Hoo-hoo!) and strong is your fight (Hee-hee! Hoo!) It doesn\'t matter who\'s wrong or right Just beat it (Beat it), beat it (beat it) No one wants to be defeated Show them how funky and strong is your fight It doesn\'t matter who\'s wrong or right (Who\'s right) Just beat it (Beat it), beat it (beat it, hoo-hoo!) No one wants to be defeated" # Post a comment on the issue with formatted text curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -d "{\"body\": \"$COMMENT_BODY\"}" \ "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments" # Close the issue curl -X PATCH \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -d '{"state": "closed"}' \ "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER"