Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): recognize underscore and singular feature-flag scopes in auto-labeler (#72478)

Phil Haackd53eb1e7eca7
diff --git a/.github/auto-assign-labels.json b/.github/auto-assign-labels.json
index 83df39925b73..25f5ba83d500 100644
--- a/.github/auto-assign-labels.json
+++ b/.github/auto-assign-labels.json
@@ -2,7 +2,7 @@
"_comment": "Maps a PR's conventional-commit scope (the part in parens of `type(scope): summary`) to labels the Auto Assign Labels workflow applies. Owned by @PostHog/team-feature-flags via owners.yaml, so mappings can change without editing the workflow or script. Scopes are matched case-insensitively. Labels must already exist in the repo. Add a new object to `rules` to map more scopes.",
"rules": [
{
- "scopes": ["flags", "feature-flags"],
+ "scopes": ["flags", "flag", "feature-flags", "feature-flag", "feature_flags", "feature_flag"],
"labels": ["feature/feature-flags", "team/feature-flags"]
},
{
diff --git a/.github/scripts/label-pr-from-title.test.js b/.github/scripts/label-pr-from-title.test.js
index a29e16a8f073..78454b87c5bd 100644
--- a/.github/scripts/label-pr-from-title.test.js
+++ b/.github/scripts/label-pr-from-title.test.js
@@ -12,7 +12,10 @@ const { parseScopes, labelsForTitle, loadRules } = require('./label-pr-from-titl
// Mirrors the rule shape in .github/auto-assign-labels.json so the logic is
// exercised against the real structure without reading the file.
const RULES = [
- { scopes: ['flags', 'feature-flags'], labels: ['feature/feature-flags', 'team/feature-flags'] },
+ {
+ scopes: ['flags', 'flag', 'feature-flags', 'feature-flag', 'feature_flags', 'feature_flag'],
+ labels: ['feature/feature-flags', 'team/feature-flags'],
+ },
{ scopes: ['cohort', 'cohorts'], labels: ['team/feature-flags', 'feature/cohorts'] },
]
@@ -44,6 +47,11 @@ const LABELS_FOR_TITLE_CASES = [
expected: ['feature/feature-flags', 'team/feature-flags'],
description: 'feature-flags alias',
},
+ {
+ title: 'feat(feature_flags): x',
+ expected: ['feature/feature-flags', 'team/feature-flags'],
+ description: 'underscore feature_flags alias',
+ },
{ title: 'fix(cohort): x', expected: ['team/feature-flags', 'feature/cohorts'], description: 'cohort scope' },
{
title: 'feat(cohorts)!: x',
@@ -85,3 +93,13 @@ test('the shipped config loads into well-formed rules', () => {
test('the shipped config still maps the flags scope to labels', () => {
assert.ok(labelsForTitle('feat(flags): x', loadRules()).length > 0, 'flags scope maps to no labels')
})
+
+// Contributors write the flags scope several ways; these aliases were silently
+// unlabeled until they were added to the config. Bind each to the shipped
+// config (not just the RULES mirror) so a future edit that drops one regresses
+// loudly here.
+for (const scope of ['flag', 'feature-flag', 'feature_flags', 'feature_flag']) {
+ test(`the shipped config maps the ${scope} scope to labels`, () => {
+ assert.ok(labelsForTitle(`feat(${scope}): x`, loadRules()).length > 0, `${scope} scope maps to no labels`)
+ })
+}