Browse Source

Update issue-check.yml

pull/4046/head
ImSwordQueen 12 months ago
parent
commit
2c9fee6fd9
  1. 15
      .github/workflows/issue-check.yml

15
.github/workflows/issue-check.yml

@ -2,12 +2,11 @@ name: MSHUWAP Issue Handler
on: on:
issues: issues:
types: [opened] # Trigger when an issue is opened types: [opened] # Triggers when an issue is opened
jobs: jobs:
check_keywords: check_keywords:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -16,19 +15,16 @@ jobs:
id: check_keywords id: check_keywords
run: | run: |
# Define the list of keywords # Define the list of keywords
keywords=("Virus" "Malware" "Windows Defender" "Antivirus" "bitdefender" "defender" "kaspersky" "unwanted" "harmful") keywords=("Virus" "Malware" "Windows Defender" "Antivirus" "bitdefender" "defender" "kaspersky" "unwanted" "unwanted" "harmful")
# Get the issue title and body from the event context # Get the issue title and body from the event context
ISSUE_TITLE="${{ github.event.issue.title }}" ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_BODY="${{ github.event.issue.body }}" ISSUE_BODY="${{ github.event.issue.body }}"
# Log the custom message
echo "Checking Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}"
# Check if any of the keywords are present in the title or body # Check if any of the keywords are present in the title or body
for keyword in "${keywords[@]}"; do for keyword in "${keywords[@]}"; do
if [[ "$ISSUE_TITLE" == *"$keyword"* ]] || [[ "$ISSUE_BODY" == *"$keyword"* ]]; then if [[ "$ISSUE_TITLE" == *"$keyword"* ]] || [[ "$ISSUE_BODY" == *"$keyword"* ]]; then
echo "'$keyword' found" echo "'$keyword'"
echo "contains_keyword=true" >> $GITHUB_ENV echo "contains_keyword=true" >> $GITHUB_ENV
break break
fi fi
@ -42,7 +38,10 @@ jobs:
# Post a comment on the issue # Post a comment on the issue
curl -X POST \ curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"body": "Checking Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}\n\nBum behavior. Closed"}' \ -d '{"body": "Bum behavior. Closed
i want to know
if these will be separate
or not"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments" "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments"
# Close the issue # Close the issue

Loading…
Cancel
Save