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, "Dont you ever come around here Dont wanna see your face, you better disappear" The fires 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!) Dont wanna see no blood, dont 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 doesnt matter whos 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] Theyre out to get you, better leave while you can Dont 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 youre really not scared (Ooh!) Youre playin with your life, this aint no truth or dare (Ooh!) Theyll kick you, then theyll beat you, then theyll tell you its 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 doesnt matter whos 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 doesnt matter whos 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 doesnt matter whos wrong or right (Whos 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 doesnt matter whos 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 doesnt matter whos 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 doesnt matter whos wrong or right (Whos 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"