Skip to content

Freeze when using Add > Text > Title in certain score (score with Staff type change marks) #2006

Freeze when using Add > Text > Title in certain score (score with Staff type change marks)

Freeze when using Add > Text > Title in certain score (score with Staff type change marks) #2006

name: Delete spam comments
on:
issue_comment:
types: [created]
permissions:
issues: write
jobs:
delete_spam_comment:
runs-on: ubuntu-latest
steps:
- name: "Delete spam comment"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const payload = context.payload;
const comment = payload.comment;
const commentBody = comment.body;
const isSpam = commentBody.includes('password: changeme')
|| commentBody.includes('mediafire.')
|| commentBody.includes('gofile')
|| commentBody.includes('fix your trouble try');
if (isSpam) {
console.log('Deleting spam comment');
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id
});
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'The previous comment was preventively deleted because it was identified as spam. As long as you have not clicked the link in this comment, you are safe.'
});
} else {
console.log('Comment is not spam');
}