name: Chore Bot
on:
push:
branches: [main]
paths: ['src/**', 'crates/**', 'Cargo.toml', 'Cargo.lock']
pull_request:
branches: [main]
paths: ['src/**', 'crates/**', 'Cargo.toml', 'Cargo.lock']
jobs:
chore:
runs-on: blacksmith
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-workspaces: true
- name: Run chore fix
run: |
chmod +x scripts/rust-chore.sh
bash scripts/rust-chore.sh fix || true
bash scripts/rust-chore.sh verify || true
- name: Generate report
run: |
bash scripts/rust-chore.sh report > /tmp/chore-report.md || echo "no report"
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
continue-on-error: true
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('/tmp/chore-report.md', 'utf8');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: report.substring(0, 65536)
});