diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 4aba4b8..e95e6f8 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -35,83 +35,3 @@ jobs: - name: Run Ruff linter run: ruff check . --output-format=github - - # Optional: Create a comment on PR with formatting suggestions - ruff-suggestions: - if: github.event_name == 'pull_request' && failure() - needs: ruff - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Ruff - run: pip install ruff - - - name: Generate fix suggestions - run: | - echo "## 🎨 Ruff Formatting & Linting Report" >> suggestions.md - echo "" >> suggestions.md - echo "Run the following commands locally to fix issues:" >> suggestions.md - echo "" >> suggestions.md - echo '```bash' >> suggestions.md - echo "ruff format ." >> suggestions.md - echo "ruff check . --fix" >> suggestions.md - echo '```' >> suggestions.md - echo "" >> suggestions.md - - # Show what would be changed - echo "### Formatting changes needed:" >> suggestions.md - echo '```diff' >> suggestions.md - ruff format --check . --diff >> suggestions.md 2>&1 || true - echo '```' >> suggestions.md - echo "" >> suggestions.md - - # Show linting issues - echo "### Linting issues:" >> suggestions.md - echo '```' >> suggestions.md - ruff check . >> suggestions.md 2>&1 || true - echo '```' >> suggestions.md - - - name: Comment PR - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const suggestions = fs.readFileSync('suggestions.md', 'utf8'); - - // Find existing comment - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - - const botComment = comments.find(comment => - comment.user.type === 'Bot' && - comment.body.includes('🎨 Ruff Formatting & Linting Report') - ); - - if (botComment) { - // Update existing comment - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: suggestions - }); - } else { - // Create new comment - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: suggestions - }); - } \ No newline at end of file