Repository navigation
feat: add SVGO auto-optimize, PR/stale hygiene, and AI PR review - #1108
Conversation
Co-Authored-By: Glinr <bot@glincker.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
Co-Authored-By: Glinr <bot@glincker.com>
… level Co-Authored-By: Glinr <bot@glincker.com>
|
|
| steps.changed.outputs.files != '' && | ||
| github.event_name == 'pull_request' && | ||
| github.event.pull_request.head.repo.full_name != github.repository |
There was a problem hiding this comment.
For every fork PR that changes an SVG, this condition fails the job based on the original changed-file list. It never checks whether SVGO actually modified the file, so even an already-optimized SVG receives a failing check and rerunning the instructed command cannot make it pass.
| if git cat-file -e "$BASE" 2>/dev/null; then | ||
| FILES=$(git diff --name-only --diff-filter=ACM "$BASE" HEAD -- 'public/icons/**/*.svg') | ||
| else | ||
| FILES=$(git diff --name-only --diff-filter=ACM --root HEAD -- 'public/icons/**/*.svg') |
There was a problem hiding this comment.
Earlier SVG changes are skipped
When a push contains more than one commit, github.event.before can be missing from this two-commit checkout. This fallback then compares only the latest commit for a non-root HEAD, so SVGs changed in earlier commits from the same push are skipped and can reach main without optimization.
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write |
There was a problem hiding this comment.
actions/stale@v11 enumerates pull requests through GitHub's issues API before applying PR-specific stale behavior, but this job grants only pull-requests: write. Scheduled runs therefore fail with an inaccessible-resource error instead of labeling, commenting on, or closing stale PRs.
| permissions: | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/first-interaction@v3 |
There was a problem hiding this comment.
Privileged actions use mutable tags
The new workflows use mutable major tags for actions/first-interaction, actions/stale, and actions/checkout while granting pull-request or repository-content write access. If one of these tags is retargeted or compromised, different code will silently receive those privileges. Pin these references to full commit SHAs, as already done for the new git auto-commit action.
How this was verified: The referenced major tags are mutable and execute in jobs explicitly granted pull-request or contents write permissions.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!



Summary
svgo.yml: optimizes changed icon SVGs underpublic/icons/**and commits the result back automatically (push to main and same-repo PR branches; fork PRs fail the check with instructions, then get optimized automatically once merged, since a workflow can't push to someone else's fork).hygiene.yml: welcomes first-time PR authors, and runs a generic 30-day-stale / +7-day-close sweep for PRs only. Issues are intentionally left alone here sincestale-icon-issues.ymlalready runs a more specific, triage-label-aware sweep, andtriage-icon-issue.ymlalready comments on every new issue.Kept OSS-only and free by design: SVGO is a plain open-source npm tool, and the welcome/stale bots are native GitHub Actions. No external API keys, accounts, or paid services required. (Dropped the originally-proposed AI PR-review workflow since it depended on a Gemini API key, which isn't something this project wants to require.)
Test plan
actionlint.ymlpasses on this PRpublic/icons/**/*.svgfile and confirm SVGO commits an optimized version backSummary by CodeRabbit