diff --git a/.github/workflows/delete-comments.yml b/.github/workflows/delete-comments.yml index 4fb5f1a..5954ee4 100644 --- a/.github/workflows/delete-comments.yml +++ b/.github/workflows/delete-comments.yml @@ -5,35 +5,26 @@ on: jobs: delete-comments: runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write steps: + - name: Checkout repository uses: actions/checkout@v4 - + - name: Delete comments run: | - set -x # Enable debug mode to see commands being run - PRS=$(gh pr list --state open --json number -q '.[].number') || { echo "Failed to list PRs"; exit 1; } - echo "Found PRs: $PRS" - + PRS=$(gh pr list --state open --json number -q '.[].number') for PR in $PRS; do - echo "Processing PR #$PR" # 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') || { echo "Failed to get comments for PR #$PR"; continue; } - - echo "Found comments to delete: $COMMENTS" + --jq '.[] | select(.body | contains("Can't wait to you")) | .id') # Delete each matching comment for COMMENT_ID in $COMMENTS; do - echo "Attempting to delete comment $COMMENT_ID from PR #$PR" - gh api --method DELETE /repos/${{ github.repository }}/issues/comments/$COMMENT_ID || echo "Failed to delete comment $COMMENT_ID" + gh api --method DELETE /repos/${{ github.repository }}/issues/comments/$COMMENT_ID + echo "Deleted comment $COMMENT_ID from PR #$PR" done done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_DEBUG: 1 # Enable GitHub CLI debugging