Browse Source

Update issue-check.yml

pull/4046/head
ImSwordQueen 12 months ago
parent
commit
80dc996c6e
  1. 12
      .github/workflows/issue-check.yml

12
.github/workflows/issue-check.yml

@ -7,15 +7,20 @@ on:
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
- name: Log check message
run: |
echo "Check if issue is a known issue"
- name: Check for keywords in issue title and body - name: Check for keywords in issue title and body
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" "unwanted" "harmful") keywords=("Virus" "Malware" "Windows Defender" "Antivirus" "bitdefender" "defender" "kaspersky" "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 }}"
@ -24,7 +29,7 @@ jobs:
# 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'" echo "'$keyword' found"
echo "contains_keyword=true" >> $GITHUB_ENV echo "contains_keyword=true" >> $GITHUB_ENV
break break
fi fi
@ -44,6 +49,5 @@ jobs:
# Close the issue # Close the issue
curl -X PATCH \ curl -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"state": "closed" -d '{"state": "closed", "reason": "not planned"}' \
"reason":"not planned"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER" "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER"

Loading…
Cancel
Save