mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 11:58:14 +01:00
122 lines
4.9 KiB
YAML
122 lines
4.9 KiB
YAML
# Duplication is measured, and the measurement is a ratchet.
|
|
#
|
|
# Every duplication in this fleet was already known before it was measured —
|
|
# orangecat's rate-limiting ADR has sat "Proposed" since January while the count
|
|
# went from two to four. Knowing has never changed the number. A weekly report
|
|
# that nobody can act on would repeat that mistake, so the report exists to make
|
|
# the trend visible and `--check` exists to make it binding.
|
|
name: Shared inventory
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: [registers/packages.json]
|
|
schedule:
|
|
# Weekly. Duplication grows on the timescale of features and new repos, not
|
|
# individual commits — a daily run would be noise, and noise gets muted.
|
|
- cron: '41 6 * * 1'
|
|
repository_dispatch:
|
|
types: [shared-package-release]
|
|
workflow_dispatch:
|
|
inputs:
|
|
strict:
|
|
description: 'Fail when duplication has risen'
|
|
type: boolean
|
|
default: true
|
|
|
|
concurrency:
|
|
group: shared-inventory
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
inventory:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
token: ${{ secrets.FLEET_PAT }}
|
|
|
|
- name: Measure the fleet
|
|
env:
|
|
# Same gap as the verify-floor audit, stated rather than hidden: the
|
|
# default token reads public repos only, so private ones are silently
|
|
# omitted. The script prints how many repos it inspected — a drop in
|
|
# that number is the tell. Set FLEET_READ_TOKEN to cover all of them.
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -uo pipefail
|
|
{
|
|
echo '## Shared inventory'
|
|
echo
|
|
echo '```'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
set +e
|
|
bash scripts/ci/shared-inventory.sh 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"
|
|
set -e
|
|
echo '```' >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
# The other half of the same question, and the half that was never asked.
|
|
# shared-inventory counts the duplication that SHOULD become a package;
|
|
# this counts the packages that already exist and cannot be found in the
|
|
# registry. bip-kit had eight adopters and no row for weeks — every agent
|
|
# told to "check SHARED.md before building" was told to check a file that
|
|
# did not mention it. Same job because it is the same file's health, and
|
|
# the report is useless split across two summaries.
|
|
- name: Every adopted package has a registry row
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -uo pipefail
|
|
{
|
|
echo '## Shared registry'
|
|
echo
|
|
echo '```'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
set +e
|
|
node scripts/ci/shared-registry-audit.mjs 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"
|
|
set -e
|
|
echo '```' >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
# Changed facts are proposed, never pushed over required-check protection.
|
|
# Only facts already on main may notify the public catalogue.
|
|
- name: Derive the package registry and notify only landed facts
|
|
id: registry
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
FLEET_DISPATCH_TOKEN: ${{ secrets.FLEET_PAT }}
|
|
run: bash scripts/ci/publish-package-registry.sh
|
|
|
|
- name: Propose changed registry through the normal merge gates
|
|
if: steps.registry.outputs.changed == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT }}
|
|
run: node scripts/ci/generated-pr.mjs registry
|
|
|
|
# ── the ratchets, last and INDEPENDENT ─────────────────────────────────
|
|
#
|
|
# Both reports run before either ratchet, and each ratchet carries
|
|
# `!cancelled()` so that one going red cannot hide the other. Without
|
|
# that, the first failing check ends the job and the second gate never
|
|
# runs — it would report green-by-absence forever, which is worse than
|
|
# not having it. The duplication ratchet was already red when the
|
|
# registry gate was added (ai-provider-client 17 -> 19), so this was the
|
|
# live case, not a hypothetical.
|
|
- name: The ratchet — duplication may fall, never rise
|
|
if: ${{ !cancelled() && (github.event_name != 'workflow_dispatch' || inputs.strict != false) }}
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
run: bash scripts/ci/shared-inventory.sh --check
|
|
|
|
- name: The registry must list what the fleet actually depends on
|
|
if: ${{ !cancelled() && (github.event_name != 'workflow_dispatch' || inputs.strict != false) }}
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
run: node scripts/ci/shared-registry-audit.mjs --check
|