Files
computer-playbook/scripts/github/resolve_release_inputs.sh
T
kevinveenbirkenbachandClaude Opus 4.7 f3845323f1 test(lint): cap inline literal script blocks at 12 logical lines + extract offenders
Add tests/lint/repository/test_inline_script_block_size.py: scans
roles/, tasks/, playbooks/ and .github/ YAML for literal block scalars
(`|` / `|-` / `|+`) following the keys `shell`, `command`, `script`,
`raw` (Ansible) and `run` (GitHub Actions). Counts logical lines —
trailing-`\` continuations collapse to one line, blank lines are
ignored — and fails when a block exceeds 12.

FOLDED scalars (`>` / `>-` / `>+`) are exempt: they are one shell
statement after YAML folding, even if they span many source lines for
readability.

The walk goes through `utils.cache.files.iter_project_files(...)` per
`docs/agents/action/testing.md` so the shared project-tree cache is
reused across the lint suite.

The fail message tells the author exactly how to fix: Ansible tasks
get the built-in `script:` module (collapses the task to one line);
GitHub Actions workflows extract into `scripts/github/<name>.sh` and
call it via `run: bash scripts/github/<name>.sh` (or
`_helpers/scripts/github/<name>.sh` when the workflow checks out the
repo into `_helpers/`).

Extract the pre-existing literal-block offenders so the new lint
ships green:

  Ansible (script: module, file under <role>/files/)
    web-app-friendica   sync_addon.sh
    web-app-fider       create_admin_user.sh
    web-app-fider       configure_oidc_provider.sh
    web-app-mediawiki   install_or_update.sh
    web-app-mediawiki   composer_install_extension.sh
    web-app-xwiki       debug_superadmin.sh

  GitHub Actions (scripts/github/)
    pick_distro.sh
    guard_release.sh
    resolve_release_inputs.sh
    disk_pressure_report.sh

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:42:44 +02:00

28 lines
784 B
Bash
Executable File

#!/usr/bin/env bash
#
# Resolve the release-version workflow's `vars` step output: validates
# the `tag` input, then queries the meta resolvers for owner / repo
# prefix / distro list and emits all four as GITHUB_OUTPUT lines.
#
# Usage:
# resolve_release_inputs.sh VERSION_TAG
# Requires GITHUB_OUTPUT to be exported (provided by the runner).
set -euo pipefail
version_tag="$1"
[[ -n "$version_tag" ]] || {
echo "ERROR: tag input is required"
exit 1
}
owner="$(_helpers/scripts/meta/resolve/repository/owner.sh)"
repo_prefix="$(_helpers/scripts/meta/resolve/repository/name.sh)"
distros="$(_helpers/scripts/meta/resolve/distros.sh)"
{
echo "version_tag=${version_tag}"
echo "distros=${distros}"
echo "repo_prefix=${repo_prefix}"
echo "owner=${owner}"
} >>"$GITHUB_OUTPUT"