mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-16 09:09:48 +00:00
f0c98e23f1
* ci: add pr labeler * ci: add issue labeler * ci: minor fixes for labelers * fix(ci): add explicit path for pr labeler
106 lines
5.0 KiB
YAML
106 lines
5.0 KiB
YAML
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# This workflow automatically labels issues based on their content.
|
|
name: Issue Labeler
|
|
on:
|
|
# Trigger on new issues and edits to existing issues
|
|
issues:
|
|
types: [opened, edited]
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
|
|
jobs:
|
|
label-issue:
|
|
name: Auto Label Issue
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'huggingface/lerobot'
|
|
steps:
|
|
- uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
// Setup Input Text (Unified Title + Body)
|
|
const body = (context.payload.issue.body || '');
|
|
const title = (context.payload.issue.title || '');
|
|
|
|
// We keep a lowercased version for keyword matching
|
|
const text = `${title}\n${body}`.toLowerCase();
|
|
|
|
const labelsToAdd = new Set();
|
|
|
|
// Helper: Simple regex test
|
|
const matches = (re) => re.test(text);
|
|
|
|
// Issue Type Detection (Dropdowns & Explicit Headers)
|
|
if (text.includes('bug report') || /\bissue type:.*bug/.test(text)) {
|
|
labelsToAdd.add('bug');
|
|
}
|
|
if (text.includes('feature request') || /\bissue type:.*feature/.test(text)) {
|
|
labelsToAdd.add('enhancement');
|
|
}
|
|
if (text.includes('technical question') || /\bissue type:.*question/.test(text)) {
|
|
labelsToAdd.add('question');
|
|
}
|
|
if (text.includes('maintenance') || /\bissue type:.*maintenance/.test(text)) {
|
|
labelsToAdd.add('documentation');
|
|
}
|
|
|
|
// Keyword Heuristic
|
|
|
|
// Domain Specific
|
|
if (matches(/example(s)?\b|script(s)?\b|sample(s)?\b|demo(s)?\b|notebook(s)?\b/i)) labelsToAdd.add('examples');
|
|
if (matches(/dataset(s)?\b|data loader|data augmentation|data preprocessing/i)) labelsToAdd.add('dataset');
|
|
if (matches(/mujoco|isaac|\bsimulation\b|\bsim /i)) labelsToAdd.add('simulation');
|
|
if (matches(/train|loss|optimizer|backward|gradient|wandb|sac\b/i)) labelsToAdd.add('training');
|
|
if (matches(/rerun|plot|video|render|visualiz|gif/i)) labelsToAdd.add('visualization');
|
|
if (matches(/camera|realsense|lidar|depth|sensor|imu|microphone|rgbd/i)) labelsToAdd.add('sensors');
|
|
if (matches(/aloha|koch|so-100|so100|mobile|teleop|manipulator|robot(s)?\b/i)) labelsToAdd.add('robots');
|
|
if (matches(/teleop|teleoperator|controller|leader|follower|joystick|gamepad/i)) labelsToAdd.add('teleoperators');
|
|
if (matches(/policy|policies|p0licy/i)) labelsToAdd.add('policies');
|
|
if (matches(/processor(s)?\b|implement.*processor|processor pipeline/i)) labelsToAdd.add('processor');
|
|
if (matches(/eval|evaluate|evaluation|metric(s)?\b|score|benchmark/i)) labelsToAdd.add('evaluation');
|
|
|
|
// Infrastructure & Code Quality
|
|
if (matches(/test|pytest|unittest|failing test/i)) labelsToAdd.add('tests');
|
|
if (matches(/ci|github actions|workflow|gha|action(s)?\b|pipeline/i)) {
|
|
labelsToAdd.add('CI');
|
|
labelsToAdd.add('github_actions');
|
|
}
|
|
if (matches(/perf|latency|benchmark|throughput|fps|speed|performance|benchmarking/i)) labelsToAdd.add('performance');
|
|
if (matches(/dependency|requirements|pip|conda|install error|importerror|package not found/i)) labelsToAdd.add('dependencies');
|
|
if (matches(/python\b|pyproject|requirements(\.txt)?|pip install|typing error/i)) labelsToAdd.add('python');
|
|
|
|
// Documentation & Meta
|
|
if (matches(/doc|documentation|docs|readme|typo|how to/i)) labelsToAdd.add('documentation');
|
|
if (matches(/refactor|cleanup|restructure|rename|modernize code/i)) labelsToAdd.add('refactor');
|
|
if (matches(/release|changelog|version bump|cut a release|tag v/i)) labelsToAdd.add('release');
|
|
|
|
// Fixed: "BREAKING CHANGE" must be lowercase in regex because 'text' is lowercase
|
|
if (matches(/breaking change|breaking:|major change/i)) labelsToAdd.add('breaking change');
|
|
|
|
// Apply Labels
|
|
const labels = Array.from(labelsToAdd).filter(Boolean);
|
|
|
|
if (labels.length > 0) {
|
|
console.log(`Adding labels: ${labels.join(', ')}`);
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels,
|
|
});
|
|
}
|