From 3b684cec48b43cbc5bd751cd8dde9a1279206935 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Tue, 24 Nov 2026 16:19:08 +0000 Subject: [PATCH 1/3] chore: add automated PR labeling workflow --- .github/labeler.yml | 57 +++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..e3b5d1773 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,57 @@ +V1: + - changed-files: + - any-glob-to-any-file: + - roborock/**/v1/** + - roborock/**/v1_*.py + - tests/**/v1/** + - tests/**/test_v1_*.py + +Q10: + - changed-files: + - any-glob-to-any-file: + - roborock/**/*q10*/** + - roborock/**/*q10* + - tests/**/*q10*/** + - tests/**/*q10* + +Q7: + - changed-files: + - any-glob-to-any-file: + - roborock/**/*q7*/** + - roborock/**/*q7* + - roborock/map/b01_map_parser.py + - roborock/map/proto/b01_scmap* + - tests/**/*q7*/** + - tests/**/*q7* + +A01: + - changed-files: + - any-glob-to-any-file: + - roborock/**/{a01,dyad,zeo}/** + - roborock/**/*{a01,dyad,zeo}* + - tests/**/{a01,dyad,zeo}/** + - tests/**/*{a01,dyad,zeo}* + +Mower: + - changed-files: + - any-glob-to-any-file: + - roborock/**/mower/** + - roborock/**/*mower* + - tests/**/mower/** + - tests/**/*mower* + +Data model changes: + - changed-files: + - any-glob-to-any-file: + - roborock/data/** + +documentation: + - changed-files: + - any-glob-to-any-file: + - docs/** + - "**/*.md" + +github_actions: + - changed-files: + - any-glob-to-any-file: + - .github/** diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 000000000..95d21b6e6 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,64 @@ +name: PR Labeler + +on: + pull_request_target: + types: [opened, synchronize, reopened, edited] + +permissions: + contents: read + pull-requests: write + +concurrency: + group: labeler-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + label: + name: Label PR + runs-on: ubuntu-latest + steps: + - name: Apply path-based labels + uses: actions/labeler@v7 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Apply size and conventional commit labels + uses: actions/github-script@v9 + with: + script: | + const pr = context.payload.pull_request; + const owner = context.repo.owner; + const repo = context.repo.repo; + const issue_number = pr.number; + + const existing = new Set((pr.labels || []).map((l) => l.name)); + const toAdd = []; + + const totalChanges = (pr.additions || 0) + (pr.deletions || 0); + const isSmall = totalChanges < 200; + if (isSmall && !existing.has("Small PR")) { + toAdd.push("Small PR"); + } else if (!isSmall && existing.has("Small PR")) { + await github.rest.issues.removeLabel({ + owner, + repo, + issue_number, + name: "Small PR", + }); + } + + const title = pr.title || ""; + if (/^feat(\(.+\))?!?:/i.test(title) && !existing.has("Feature")) { + toAdd.push("Feature"); + } else if (/^fix(\(.+\))?!?:/i.test(title) && !existing.has("bug")) { + toAdd.push("bug"); + } + + if (toAdd.length > 0) { + await github.rest.issues.addLabels({ + owner, + repo, + issue_number, + labels: toAdd, + }); + } From 4e62cad16e709026c323371a61e9760b6457236f Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Tue, 24 Nov 2026 16:32:19 +0000 Subject: [PATCH 2/3] chore: simplify labeler workflow to actions/labeler only --- .github/workflows/labeler.yml | 62 ++++------------------------------- 1 file changed, 6 insertions(+), 56 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 95d21b6e6..969da9842 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,63 +2,13 @@ name: PR Labeler on: pull_request_target: - types: [opened, synchronize, reopened, edited] - -permissions: - contents: read - pull-requests: write - -concurrency: - group: labeler-${{ github.event.pull_request.number }} - cancel-in-progress: true + types: [opened, synchronize, reopened] jobs: - label: - name: Label PR + labeler: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - - name: Apply path-based labels - uses: actions/labeler@v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Apply size and conventional commit labels - uses: actions/github-script@v9 - with: - script: | - const pr = context.payload.pull_request; - const owner = context.repo.owner; - const repo = context.repo.repo; - const issue_number = pr.number; - - const existing = new Set((pr.labels || []).map((l) => l.name)); - const toAdd = []; - - const totalChanges = (pr.additions || 0) + (pr.deletions || 0); - const isSmall = totalChanges < 200; - if (isSmall && !existing.has("Small PR")) { - toAdd.push("Small PR"); - } else if (!isSmall && existing.has("Small PR")) { - await github.rest.issues.removeLabel({ - owner, - repo, - issue_number, - name: "Small PR", - }); - } - - const title = pr.title || ""; - if (/^feat(\(.+\))?!?:/i.test(title) && !existing.has("Feature")) { - toAdd.push("Feature"); - } else if (/^fix(\(.+\))?!?:/i.test(title) && !existing.has("bug")) { - toAdd.push("bug"); - } - - if (toAdd.length > 0) { - await github.rest.issues.addLabels({ - owner, - repo, - issue_number, - labels: toAdd, - }); - } + - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 From 108ab7c9ee2b494c41724ef305f40a80e3b91a5f Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Tue, 24 Nov 2026 16:35:57 +0000 Subject: [PATCH 3/3] chore: use major version tag for actions/labeler --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 969da9842..12c18dfbc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -11,4 +11,4 @@ jobs: contents: read pull-requests: write steps: - - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 + - uses: actions/labeler@v7