Skip to content

base loader: fix micro batch is_processed marking, add tests #105

base loader: fix micro batch is_processed marking, add tests

base loader: fix micro batch is_processed marking, add tests #105

Workflow file for this run

name: Ruff
permissions:
contents: read
on:
push:
branches: [ main ]
paths:
- '**.py'
- 'pyproject.toml'
- '.github/workflows/ruff.yml'
pull_request:
branches: [ main ]
paths:
- '**.py'
- 'pyproject.toml'
- '.github/workflows/ruff.yml'
jobs:
ruff:
runs-on: ubuntu-latest
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: Run Ruff format check
run: ruff format --check . --diff
- 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
});
}