ci(labeler): apply at most one scope label per PR (#28965)

actions/labeler adds every scope whose globs match any changed file, so a PR touching a test, a param file and a board config collects a pile of scope labels (2.6 per PR on average over the last 300, up to 20) and nobody reads them. A scope label is only useful when it names the core of the PR.

The title's conventional-commit scope already states that core, so the scope label now comes from it, resolved to an area of the tree; the diff decides only when the title names nothing. Each file belongs to one scope, and labels this workflow added earlier are removed when they stop matching. scope:testing, scope:uorb, scope:middleware and scope:logging are no longer applied.

Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
Jacob Dahl authored and GitHub committed 2026-10-01 20:42:03 -06:00
1 parent e56ba2e825
commit 42ce28a986
3 files changed
+386 -248

No files matched your search

+2 -246
View File
@@ -2,252 +2,8 @@
# The action is ./.github/workflows/label.yml
# Docs for the syntax in this file can be found at
# https://github.com/actions/labeler
"scope:boards":
- changed-files:
- any-glob-to-any-file:
- boards/**
- src/drivers/px4io/**
- src/modules/px4iofirmware/**
"scope:build-system":
- changed-files:
- any-glob-to-any-file:
- CMakeLists.txt
- Makefile
- Kconfig
- cmake/**
- platforms/*/cmake/**
- platforms/*/Kconfig
- boards/**/Kconfig
- boards/**/*.cmake
- boards/**/*.px4board
"scope:commander":
- changed-files:
- any-glob-to-any-file:
- src/modules/commander/**
"scope:control":
- changed-files:
- any-glob-to-any-file:
- src/modules/*_att_control/**
- src/modules/*_rate_control/**
- src/modules/*_pos_control/**
- src/modules/*_mode_manager/**
- src/modules/control_allocator/**
- src/modules/flight_mode_manager/**
- src/modules/fw_lateral_longitudinal_control/**
- src/modules/mc_hover_thrust_estimator/**
- src/modules/mc_nn_control/**
- src/modules/mc_raptor/**
- src/modules/rover_*/**
- src/drivers/actuators/**
- src/drivers/dshot/**
- src/drivers/pwm_out/**
- src/drivers/pca9685_pwm_out/**
- src/drivers/tap_esc/**
"scope:dependencies":
- changed-files:
- any-glob-to-any-file:
- .gitmodules
- package.xml
- src/modules/mavlink/mavlink/**
- src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client/**
- src/lib/crypto/monocypher/**
- src/lib/heatshrink/heatshrink/**
- platforms/nuttx/NuttX/**
"scope:docs":
- changed-files:
- any-glob-to-any-file:
- docs/**
- .github/instructions/docs*.md
"scope:drivers":
- changed-files:
- any-glob-to-any-file:
- src/drivers/**
"scope:estimation":
- changed-files:
- any-glob-to-any-file:
- src/modules/ekf2/**
- src/modules/local_position_estimator/**
- src/modules/attitude_estimator_q/**
- src/modules/landing_target_estimator/**
- src/modules/mag_bias_estimator/**
- src/modules/gyro_calibration/**
- src/modules/gyro_fft/**
- Tools/ecl_ekf/**
"scope:infrastructure":
- changed-files:
- any-glob-to-any-file:
- .devcontainer/**
- .github/**
- .vscode/**
- .clang-tidy
- .dockerignore
- Jenkinsfile
- Tools/ci/**
- Tools/docker/**
"scope:logging":
- changed-files:
- any-glob-to-any-file:
- src/modules/logger/**
- src/modules/replay/**
- src/modules/events/**
- src/modules/hardfault_stream/**
- src/lib/events/**
- Tools/flight_review/**
- Tools/log_encryption/**
"scope:mavlink":
- changed-files:
- any-glob-to-any-file:
- src/modules/mavlink/**
- src/drivers/telemetry/**
- src/drivers/transponder/**
- Tools/HIL/**
"scope:middleware":
- changed-files:
- any-glob-to-any-file:
- src/modules/muorb/**
- src/modules/uxrce_dds_client/**
- src/modules/zenoh/**
- src/drivers/cyphal/**
- src/drivers/uavcan/**
- src/drivers/uavcannode/**
- platforms/ros2/**
- Tools/ros2/**
- msg/translation_node/**
"scope:navigation":
- changed-files:
- any-glob-to-any-file:
- src/modules/navigator/**
- src/modules/dataman/**
- src/modules/land_detector/**
- src/modules/payload_deliverer/**
- src/lib/collision_prevention/**
- src/lib/geofence/**
- src/lib/landing_slope/**
- src/lib/takeoff/**
- src/lib/weather_vane/**
"scope:offboard":
- changed-files:
- any-glob-to-any-file:
- src/modules/mavlink/mavlink_offboard.cpp
- src/modules/mavlink/mavlink_receiver.*
- src/modules/mavlink/streams/TRAJECTORY_REPRESENTATION_*.hpp
- src/modules/uxrce_dds_client/**
- src/modules/zenoh/**
- msg/OffboardControlMode.msg
- msg/TrajectorySetpoint.msg
- msg/versioned/TrajectorySetpoint.msg
- msg/versioned/VehicleCommand.msg
- msg/versioned/VehicleCommandAck.msg
"scope:parameters":
- changed-files:
- any-glob-to-any-file:
- "**/*_params.c"
- "**/*_params.cpp"
- "**/*_params.yaml"
- "**/parameters.c"
- "**/parameters.cpp"
- "**/module.yaml"
- src/lib/parameters/**
- src/modules/param/**
- Tools/param_metadata/**
- ROMFS/px4fmu_common/init.d*/**/*.params
"scope:release":
- changed-files:
- any-glob-to-any-file:
- docs/**/releases/**
- docs/**/release_process.md
- Tools/packaging/**
- platforms/**/package*.sh
"scope:sensors":
- changed-files:
- any-glob-to-any-file:
- src/modules/sensors/**
- src/modules/airspeed_selector/**
- src/modules/battery_status/**
- src/modules/esc_battery/**
- src/modules/temperature_compensation/**
- src/drivers/adc/**
- src/drivers/barometer/**
- src/drivers/batt_smbus/**
- src/drivers/differential_pressure/**
- src/drivers/distance_sensor/**
- src/drivers/gnss/**
- src/drivers/gps/**
- src/drivers/hygrometer/**
- src/drivers/imu/**
- src/drivers/ins/**
- src/drivers/irlock/**
- src/drivers/magnetometer/**
- src/drivers/optical_flow/**
- src/drivers/power_monitor/**
- src/drivers/pps_capture/**
- src/drivers/rpm/**
- src/drivers/rpm_capture/**
- src/drivers/smart_battery/**
- src/drivers/tattu_can/**
- src/drivers/temperature_sensor/**
- src/drivers/uwb/**
- src/drivers/wind_sensor/**
"scope:simulation":
- changed-files:
- any-glob-to-any-file:
- launch/**
- posix-configs/**
- src/modules/simulation/**
- Tools/simulation/**
- ROMFS/px4fmu_common/init.d-posix/**
- platforms/posix/**
"scope:testing":
- changed-files:
- any-glob-to-any-file:
- integrationtests/**
- test/**
- test_data/**
- validation/**
- src/systemcmds/tests/**
- src/examples/**
- "**/*[Tt]est.*"
- "**/*_test.*"
- "**/test_*.*"
- .github/workflows/*test*.yml
- .github/workflows/checks.yml
- .github/workflows/fuzzing.yml
"scope:tools":
- changed-files:
- any-glob-to-any-file:
- Tools/**
- msg/tools/**
- src/templates/**
"scope:uorb":
- changed-files:
- any-glob-to-any-file:
- msg/**
- srv/**
- platforms/common/uORB/**
- src/lib/uORB/**
- Tools/msg/**
- Tools/uorb_graph/**
#
# Scope labels are not set here: Tools/ci/label_pr_scope.py applies at most one.
"kind:test":
- changed-files:
+20 -2
View File
@@ -1,6 +1,7 @@
# This workflow will triage pull requests and apply labels based on the
# PR title prefix and paths that are modified in the pull request.
# The path labels are set up in .github/labeler.yml
# PR title and paths that are modified in the pull request.
# The path labels are set up in .github/labeler.yml, the scope label in
# Tools/ci/label_pr_scope.py
#
# See: https://github.com/actions/labeler
@@ -9,6 +10,11 @@ on:
pull_request_target:
types: [opened, edited, synchronize, reopened, ready_for_review]
# Runs that overlap would race to add and remove the scope label.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
label:
@@ -57,3 +63,15 @@ jobs:
- uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# pull_request_target checks out the base branch: the script never runs PR code.
- uses: actions/checkout@v6
with:
sparse-checkout: Tools/ci
fetch-depth: 1
- name: Label PR scope
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: python3 Tools/ci/label_pr_scope.py --pr "$PR_NUMBER"