Skip to content

Commit 35ba87f

Browse files
authored
[CI] More labels, better labels (#1631)
1 parent f8c30f8 commit 35ba87f

2 files changed

Lines changed: 64 additions & 52 deletions

File tree

.github/labeler.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,20 @@
4747
- 'tensordict/functional.py'
4848
- 'test/test_functorch.py'
4949

50+
"Distributed":
51+
- changed-files:
52+
- any-glob-to-any-file:
53+
- 'test/test_distributed.py'
54+
55+
"Compile":
56+
- changed-files:
57+
- any-glob-to-any-file:
58+
- 'test/test_compile.py'
59+
5060
# =============================================================================
5161
# Documentation & CI
5262
# =============================================================================
53-
"Documentation":
63+
"documentation":
5464
- changed-files:
5565
- any-glob-to-any-file:
5666
- 'docs/**'

.github/workflows/pr-label.yml

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@
22
#
33
# Usage:
44
# - PR title must start with a [Label] prefix in brackets
5-
# - Example: "[BugFix] Fix memory leak" will add the "BugFix" label
5+
# - Example: "[BugFix] Fix memory leak" will add the "bug" label
66
# - Fails if no valid prefix is found
77
# - Labels are ONLY ADDED, never removed (preserves manual labels)
8+
# - Matching is case-insensitive
89
#
9-
# Supported prefixes (supports common variations):
10-
# - [BugFix], [Bugfix], [bugfix] -> BugFix
11-
# - [Feature], [Features] -> Feature
12-
# - [Doc], [Docs], [Documentation] -> Documentation
13-
# - [Refactor], [Refactoring] -> Refactor
14-
# - [CI], [ci] -> CI
15-
# - [Test], [Tests] -> Test
16-
# - [Compile], [compile] -> Compile
17-
# - [Performance], [Perf] -> Perf
18-
# - [Deprecation], [Deprecated] -> Deprecation
19-
# - [Setup], [setup] -> Setup
10+
# Supported prefixes -> label:
11+
# [BugFix], [Fix] -> bug
12+
# [Feature] -> Feature
13+
# [Doc], [Docs], [Documentation] -> documentation
14+
# [Refactor], [Refactoring] -> Refactor
15+
# [CI] -> CI
16+
# [Test], [Tests] -> Test
17+
# [Compile] -> Compile
18+
# [Performance], [Perf] -> Performance
19+
# [Deprecation], [Deprecated] -> Deprecation
20+
# [Setup] -> setup
21+
# [Distributed], [Dist] -> Distributed
22+
# [Benchmark], [Benchmarks], [Bench] -> Benchmarks
23+
# [Typing], [Type] -> Typing
24+
# [BC-breaking], [BC] -> BC-breaking
25+
# [Formatting], [Format] -> Formatting
26+
# [Quality] -> Quality
2027
#------------------------------------------------------------
2128

2229
name: PR Label
@@ -54,22 +61,28 @@ jobs:
5461
5562
### Supported Prefixes
5663
57-
Your PR title must start with **exactly** one of these prefixes:
64+
Your PR title must start with **exactly** one of these prefixes (case-insensitive):
5865
5966
| Prefix | Label Applied | Example |
6067
|--------|---------------|---------|
61-
| `[BugFix]` | BugFix | `[BugFix] Fix memory leak in TensorDict` |
68+
| `[BugFix]` or `[Fix]` | bug | `[BugFix] Fix memory leak in TensorDict` |
6269
| `[Feature]` | Feature | `[Feature] Add new storage backend` |
63-
| `[Doc]` or `[Docs]` | Documentation | `[Doc] Update installation guide` |
70+
| `[Doc]` or `[Docs]` | documentation | `[Doc] Update installation guide` |
6471
| `[Refactor]` | Refactor | `[Refactor] Clean up module imports` |
6572
| `[CI]` | CI | `[CI] Fix workflow permissions` |
6673
| `[Test]` or `[Tests]` | Test | `[Test] Add unit tests for nn module` |
6774
| `[Compile]` | Compile | `[Compile] Fix torch.compile issue` |
68-
| `[Performance]` or `[Perf]` | Perf | `[Perf] Optimize tensor operations` |
75+
| `[Performance]` or `[Perf]` | Performance | `[Perf] Optimize tensor operations` |
6976
| `[Deprecation]` | Deprecation | `[Deprecation] Mark old function` |
70-
| `[Setup]` | Setup | `[Setup] Update build configuration` |
71-
72-
**Note:** Common variations like singular/plural are supported (e.g., `[Doc]` or `[Docs]`).
77+
| `[Setup]` | setup | `[Setup] Update build configuration` |
78+
| `[Distributed]` or `[Dist]` | Distributed | `[Distributed] Add scatter collective` |
79+
| `[Benchmark]` or `[Bench]` | Benchmarks | `[Benchmark] Add compile benchmark` |
80+
| `[Typing]` or `[Type]` | Typing | `[Typing] Add type stubs` |
81+
| `[BC-breaking]` or `[BC]` | BC-breaking | `[BC-breaking] Remove deprecated API` |
82+
| `[Formatting]` or `[Format]` | Formatting | `[Format] Fix code style` |
83+
| `[Quality]` | Quality | `[Quality] Improve error messages` |
84+
85+
**Note:** Matching is case-insensitive. Common variations (singular/plural) are supported.
7386
COMMENT_EOF
7487
sed -i 's/^ *//' /tmp/pr_comment.md
7588
sed -i "s/REASON_PLACEHOLDER/$reason/" /tmp/pr_comment.md
@@ -91,38 +104,27 @@ jobs:
91104
92105
echo "Extracted prefix: $PREFIX"
93106
94-
# Map prefixes to GitHub label names (supports common variations)
95-
case "$PREFIX" in
96-
BugFix|Bugfix|bugfix)
97-
LABEL="BugFix"
98-
;;
99-
Feature|Features|feature|features)
100-
LABEL="Feature"
101-
;;
102-
Doc|Docs|Documentation|doc|docs)
103-
LABEL="Documentation"
104-
;;
105-
Refactor|Refactoring|refactor|refactoring)
106-
LABEL="Refactor"
107-
;;
108-
CI|ci)
109-
LABEL="CI"
110-
;;
111-
Test|Tests|test|tests)
112-
LABEL="Test"
113-
;;
114-
Compile|compile)
115-
LABEL="Compile"
116-
;;
117-
Performance|Perf|performance|perf)
118-
LABEL="Perf"
119-
;;
120-
Deprecation|Deprecated|deprecation|deprecated)
121-
LABEL="Deprecation"
122-
;;
123-
Setup|setup)
124-
LABEL="Setup"
125-
;;
107+
# Case-insensitive matching: lowercase the prefix once
108+
PREFIX_LOWER="${PREFIX,,}"
109+
110+
# Map prefixes to GitHub label names
111+
case "$PREFIX_LOWER" in
112+
bugfix|fix|bug) LABEL="bug" ;;
113+
feature|features) LABEL="Feature" ;;
114+
doc|docs|documentation) LABEL="documentation" ;;
115+
refactor|refactoring) LABEL="Refactor" ;;
116+
ci) LABEL="CI" ;;
117+
test|tests) LABEL="Test" ;;
118+
compile) LABEL="Compile" ;;
119+
performance|perf) LABEL="Performance" ;;
120+
deprecation|deprecated) LABEL="Deprecation" ;;
121+
setup) LABEL="setup" ;;
122+
distributed|dist) LABEL="Distributed" ;;
123+
benchmark|benchmarks|bench) LABEL="Benchmarks" ;;
124+
typing|type) LABEL="Typing" ;;
125+
bc-breaking|bc) LABEL="BC-breaking" ;;
126+
formatting|format) LABEL="Formatting" ;;
127+
quality) LABEL="Quality" ;;
126128
*)
127129
echo "::error::Unknown or invalid prefix '[$PREFIX]'."
128130
post_help_comment "Unknown or invalid prefix \`[$PREFIX]\`." "$PR_TITLE"

0 commit comments

Comments
 (0)