Skip to content

rp2xxx: Add set_interrupts_enabled and non blocking read to uart hal #318

rp2xxx: Add set_interrupts_enabled and non blocking read to uart hal

rp2xxx: Add set_interrupts_enabled and non blocking read to uart hal #318

Workflow file for this run

name: Code Linting
on:
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.14.1
- name: Build linter
working-directory: tools/linter
run: zig build --release=safe
- name: Run linter
run: |
echo "Base SHA: ${{ github.event.pull_request.base.sha }}"
echo "Head SHA: ${{ github.event.pull_request.head.sha }}"
# Get changed .zig files
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '\.zig$' || true)
echo "Changed files: $FILES"
if [ -n "$FILES" ]; then
echo "$FILES" | xargs ./tools/linter/zig-out/bin/linter > lint_results.json
else
echo "[]" > lint_results.json
fi
# Debug output
echo "Lint results:"
cat lint_results.json
- name: Post comments with metadata
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const crypto = require('crypto');
if (!fs.existsSync('lint_results.json')) {
console.log('No lint results file found');
return;
}
const content = fs.readFileSync('lint_results.json', 'utf8').trim();
if (!content || content === '[]') {
console.log('No lint issues found');
return;
}
const issues = JSON.parse(content);
const existingComments = await github.rest.pulls.listReviewComments({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const botComments = existingComments.data.filter(comment =>
comment.user.login === 'github-actions[bot]' &&
comment.body.includes('<!-- lint-comment')
);
const existingHashes = new Set();
botComments.forEach(comment => {
const match = comment.body.match(/<!-- lint-comment:(\w+) -->/);
if (match) existingHashes.add(match[1]);
});
let postedCount = 0;
let skippedCount = 0;
for (const issue of issues) {
const issueData = `${issue.file}:${issue.line}:${issue.message}`;
const issueHash = crypto.createHash('md5').update(issueData).digest('hex').substring(0, 8);
if (existingHashes.has(issueHash)) {
console.log(`Skipping duplicate issue: ${issueHash}`);
skippedCount++;
continue;
}
const commentBody = `${issue.message}\n\n<!-- lint-comment:${issueHash} -->\n`;
console.log(`comment body:`, commentBody);
try {
await github.rest.pulls.createReviewComment({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
commit_id: context.payload.pull_request.head.sha,
path: issue.file,
line: issue.line,
body: commentBody
});
postedCount++;
} catch (error) {
console.error(`Failed to post comment:`, error.message);
}
}
console.log(`Posted ${postedCount} new comments, skipped ${skippedCount} duplicates`);