Repository navigation
chore: add automated PR labeling workflow - #1091
Conversation
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Summary
Verdict: Passes /review with nits.
This PR only touches CI (.github/labeler.yml, .github/workflows/labeler.yml), so the trait, lifecycle and protocol layers (Priority 1 to 3) don't apply. I reviewed it for workflow security, whether the labels exist, and whether it clashes with the labels we apply by hand.
Security: no problems found
pull_request_targetis used the safe way. There is noactions/checkoutand norun:step, and no${{ github.event.* }}value is interpolated anywhere.actions/labelerreads.github/labeler.ymlthrough the API at the base ref, so a PR from a fork cannot change the rules that get applied to it.- Permissions are set per job and kept small (
contents: read,pull-requests: write).issues: writeisn't needed, because every label in the config already exists.
Labels: all exist and match the repo's labels exactly
- The repo already has
V1,Q10,Q7,A01,Mower,Data model changes,documentationandgithub_actions, with the same spelling and case. sync-labelsdefaults tofalsein v7, so the action only adds labels and never removes them. It won't touch/review run,Passed /review,Small PRorFeature. No workflow in the repo reacts tolabeledevents, so these added labels don't set anything else off.
I tested every glob against all the files on main. Each platform label lands on its intended directories (roborock/data/<platform>, roborock/devices/traits/<platform>, roborock/protocols/*_protocol.py, tests/..., tests/protocols/testdata/b01_*_protocol).
Nits (non-blocking)
-
.github/workflows/labeler.yml:14: pin the action by SHA. This is the one workflow in the repo that runs a third-party action with a write token on fork PRs, so a mutable@v7tag is riskier here than anywhere else. Dependabot keeps SHA pins up to date when they carry a version comment:- - uses: actions/labeler@v7 + - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 -
.github/labeler.yml: two map modules get no platform label.roborock/map/map_parser.pyis the V1 map parser (its docstring says "parsing v1 Roborock map content"), but none of theV1globs match it.roborock/map/b01_grid_layers.pyis shared by Q10 and Q7, and it matches neither.
Q7 already lists
roborock/map/b01_map_parser.pyby name. Listing these two the same way would keep map PRs labeled the same way (map_parser.pyunderV1,b01_grid_layers.pyunder bothQ10andQ7). -
.github/labeler.yml:54-57:.github/**also matches.github/skills. Because of that, a PR that only edits a skill gets labeledgithub_actions("Pull requests that update GitHub Actions code"). Consider narrowing it to.github/workflows/**and.github/dependabot.yml. Along the same lines,"**/*.md"labels skill and agent instruction files (.agents/skills/**/SKILL.md,AGENTS.md,CLAUDE.md) asdocumentation. That is probably fine; I'm only noting it.
Tests & PR hygiene
- CI is green: lint, commitlint, the test matrix, build, and the semantic-release dry run. The commits follow the
chore:convention, and the branch merges cleanly intomain. - As the PR description says,
pull_request_targetruns the workflow from the base branch, so it can't run on this PR. The first real run will be on the next PR opened after this merges.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
Summary
Adds automated path-based PR labeling using
actions/labelerto apply the repository's existing platform and scope labels automatically on PR open/update.What's included
.github/labeler.yml: Path-based rules for existing labels:V1,Q10,Q7,A01,MowerData model changes(roborock/data/**),documentation(docs/**,**/*.md),github_actions(.github/**).github/workflows/labeler.yml:actions/labeler(v7.0.0) onpull_request_target(opened,synchronize,reopened) with minimal permissions (contents: read,pull-requests: write) and no checkout of untrusted PR code so external fork PRs are labeled safely.Note
Because
pull_request_targetexecutes from the base branch (main), this workflow will not run on this PR itself and will activate once merged.