Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): correct github-script API calls #14442

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/delete-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
script: |
const comment = context.payload.comment.body;
const triggerStrings = ['www.mediafire.com', 'Download'];
const triggerStrings = ['www.mediafire.com'];
return triggerStrings.some(triggerString => comment.includes(triggerString));

- name: Delete comment if it contains any of the specific strings
Expand All @@ -26,20 +26,19 @@ jobs:
with:
script: |
const commentId = context.payload.comment.id;
await github.issues.deleteComment({
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId
});

- name: Block user if comment contains any of the specific strings
- name: Block user from the org if their comment contained any of the banned strings
if: steps.check_comment.outputs.result == 'true'
uses: actions/github-script@v7
with:
script: |
const userId = context.payload.comment.user.id;
await github.users.block({
owner: context.repo.owner,
repo: context.repo.repo,
user_id: userId
const username = context.payload.comment.user.login
await github.rest.orgs.blockUser({
org: context.repo.owner,
username: username
});
Loading