Files
fleet/.github/workflows/hardcoded-values.yml
Claude 10732a37a7 feat(ci): fleet workflows prefer a short-lived GitHub App token
Each job that used secrets.FLEET_PAT first mints an app token when
vars.FLEET_APP_ID is set and uses it, falling back to FLEET_PAT otherwise, so
nothing changes until the owner creates the app (docs/fleet-app-token.md).
FLEET_PAT is one person's token over every repository; an app token lasts an
hour and carries only the app's permissions. 56 uses in 31 workflows;
actionlint reports nothing. Stacked on the daily package train, which edits
the same workflow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmsUci3JMszzVB3ZhZZ
2026-11-16 05:56:27 +00:00

54 lines
2.2 KiB
YAML

# A value copied into code that already has one home.
#
# The sweep this gate came from found 495 such literals across 16 repos,
# including a retired product name serving on a public footer and a seed script
# that would have written two retired hosts into the database. None of them
# broke loudly, which is the whole problem: a retired host answers 308 and a
# renamed repo redirects, so every copy looks healthy until it isn't.
#
# The guards are proven BEFORE the run that judges the fleet, not after — a
# detector that never fires is indistinguishable from a clean fleet, and this
# one reported `arbitrary-hex 0` across 44 repos on its first pass.
#
# On the schedule: GitHub does not honour `schedule:` reliably here — measured
# 2026-09-15, deploy-freshness.yml fired at neither of its first two hourly
# slots and every run either it or the reconciler had was a manual dispatch.
# So the cron below is a free second chance, not the clock. Dispatch it by hand,
# or tick it from the box the way fleet-reconciler.timer ticks the reconciler.
name: Hardcoded values
on:
workflow_dispatch: {}
schedule:
- cron: '17 6 * * *'
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# A short-lived GitHub App token when the app is configured
# (vars.FLEET_APP_ID, secrets.FLEET_APP_PRIVATE_KEY); FLEET_PAT otherwise.
- id: fleet-token
if: ${{ vars.FLEET_APP_ID != '' }}
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.FLEET_APP_ID }}
private-key: ${{ secrets.FLEET_APP_PRIVATE_KEY }}
owner: bitbaum
- uses: actions/checkout@v7
- name: Prove the rules, both directions
run: python3 scripts/ci/test-hardcoded-values-audit.py
- name: Sweep every default branch
env:
# Reading PRIVATE repos needs the org PAT; GITHUB_TOKEN sees only this
# one. A sweep that silently skipped the private repos would report a
# smaller fleet as a clean one.
GH_TOKEN: ${{ steps.fleet-token.outputs.token || secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
run: python3 scripts/ci/hardcoded-values-audit.py --check | tee -a "$GITHUB_STEP_SUMMARY"