From 9b5a4d501d1945a151d0405914b9d10dac9493e3 Mon Sep 17 00:00:00 2001 From: Howard Braham Date: Fri, 13 Nov 2026 12:07:25 -0800 Subject: [PATCH 1/2] fix(add-team-label): fall back to team-bots for bot accounts GitHub Apps missing from topology.json no longer fail the job. --- .github/actions/add-team-label/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/add-team-label/action.yml b/.github/actions/add-team-label/action.yml index 12995597..9d24b567 100644 --- a/.github/actions/add-team-label/action.yml +++ b/.github/actions/add-team-label/action.yml @@ -1,5 +1,5 @@ name: Add Team Label -description: "Adds a GitHub team label to a pull request based on the author's entry in the MetaMask topology file. Skips if the PR already has a team-* or external-contributor label." +description: "Adds a GitHub team label to a pull request based on the author's entry in the MetaMask topology file. Skips if the PR already has a team-* or external-contributor label, and falls back to team-bots for bot accounts missing from the topology file." inputs: team-label-token: @@ -37,11 +37,16 @@ runs: env: GH_TOKEN: ${{ inputs.planning-token || inputs.team-label-token }} USER: ${{ github.event.pull_request.user.login }} + AUTHOR_TYPE: ${{ github.event.pull_request.user.type }} shell: bash run: | # Stream topology.json through jq, find the first team where USER appears in members, pm, em, or tl, and emit # its githubLabel.name value. team_label=$(gh api -H 'Accept: application/vnd.github.raw' 'repos/metamask/metamask-planning/contents/topology.json' | jq -r --arg USER "$USER" '.[] | select(any(.members[]?; . == $USER) or (.pm // empty) == $USER or (.em // empty) == $USER or (.tl // empty) == $USER) | .githubLabel.name' | head -n 1) + # A GitHub App (type Bot) missing from the topology file still belongs to the bots team. + if [ -z "$team_label" ] && [ "$AUTHOR_TYPE" = "Bot" ]; then + team_label=team-bots + fi if [ -z "$team_label" ]; then echo "::error::Team label not found for author: $USER. Please open a pull request with your GitHub handle and team label to update topology.json at https://github.com/MetaMask/MetaMask-planning/blob/main/topology.json" exit 1 From 355ff26134ae791a70a99ea8fc22a27d111fef77 Mon Sep 17 00:00:00 2001 From: Howard Braham Date: Fri, 13 Nov 2026 13:12:57 -0800 Subject: [PATCH 2/2] docs: add changelog entry for the team-bots fallback --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf826d09..825684f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fall back to the `team-bots` label in `add-team-label` for bot authors missing from `topology.json` ([#327](https://github.com/MetaMask/github-tools/pull/327)) + ## [1.24.0] ### Changed