Skip to content

Commit

Permalink
updated delete comment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
qcoral committed Jan 27, 2025
1 parent 490a0bd commit 0146828
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/delete-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ jobs:

- name: Delete comments
run: |
PRS=$(gh pr list --state open --json number -q '.[].number')
for PR in $PRS; do
# Get all comments on the PR
COMMENTS=$(gh api /repos/${{ github.repository }}/issues/$PR/comments \
--jq '.[] | select(.body | contains("Can't wait to you")) | .id')
# Delete each matching comment
for COMMENT_ID in $COMMENTS; do
gh api --method DELETE /repos/${{ github.repository }}/issues/comments/$COMMENT_ID
echo "Deleted comment $COMMENT_ID from PR #$PR"
done
done
PRS=$(gh pr list --state open --json number -q '.[].number')
for PR in $PRS; do
# Get all comments on the PR
COMMENTS=$(gh api /repos/hackclub/asylum/issues/$PR/comments \
--jq '.[] | select(.body | contains("Can't wait to you")) | .id')

# Delete each matching comment
if [ -n "$COMMENTS" ]; then
echo "$COMMENTS" | while IFS= read -r COMMENT_ID; do
gh api --method DELETE /repos/hackclub/asylum/issues/comments/$COMMENT_ID
echo "Deleted comment $COMMENT_ID from PR #$PR"
done
else
echo "No matching comments found for PR #$PR"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down

0 comments on commit 0146828

Please sign in to comment.