Files
computer-playbook/scripts/github/resolve/pr_affected_roles.sh
T
kevinveenbirkenbachandClaude Opus 5 f482b979bd refactor(ci): rename env/guide jobs, drop roles_only
test-environment.yml and test-guide.yml become test-workspace.yml and
test-instructions.yml. Orchestrator job ids, the distros-SPOT matrix
lint, the act example, the diagnostics slug and the rescue artefact
names follow.

Replace the roles_only input with per-job workspace/instructions
tri-state inputs (auto|true|false). 'auto' derives the former
roles_only skip straight from whitelist: both jobs run on a global
scope (whitelist empty or __ALL__) and are skipped on a role-scoped
run, which keeps the PR behaviour identical because the diff resolver
never emits an empty whitelist. entry-manual exposes both as choice
dropdowns defaulting to false, so a manual run opts in explicitly.
The now redundant roles_only output is dropped from
pr_affected_roles.sh and subset_roles.py.

Branch-protection required-status-check names change along with the
job renames.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 12:55:04 +02:00

34 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Resolve the role whitelist for a pull-request CI run and write
# `whitelist` to GITHUB_OUTPUT. This is the single entry point the
# `detect-affected-roles` job calls; it keeps the subset-vs-diff
# selection logic out of the workflow YAML.
#
# Inputs via env:
# SUBSET_LABELED "true" when the PR carries the '🧩 Subset' label.
# When set, the explicit role list declared in the PR
# body wins, resolved by the cli.meta.ci.subset_roles
# module (strict: it fails the run on
# invalid/empty/unknown roles).
# Otherwise the diff-derived resolver runs unchanged.
# PR_BODY PR body markdown (only read on the subset path).
#
# Outputs (GITHUB_OUTPUT):
# whitelist=<role-id ...|__ALL__>
set -euo pipefail
: "${GITHUB_OUTPUT:?Missing GITHUB_OUTPUT}"
if [[ "${SUBSET_LABELED:-}" == "true" ]]; then
echo "🧩 Subset label present: restricting CI to the roles listed in the PR body."
# shellcheck source=scripts/meta/env/load.sh
source "scripts/meta/env/load.sh"
exec "${PYTHON}" -m cli.meta.ci.subset_roles
fi
resolved="$(./scripts/meta/resolve/diff/affected_roles.sh)"
echo "Resolver output: ${resolved}"
printf 'whitelist=%s\n' "${resolved}" >>"${GITHUB_OUTPUT}"