From 0a47061d6c80ce508b7ca82e47e3d9ede3062db0 Mon Sep 17 00:00:00 2001 From: Gerrrt Date: Mon, 23 Nov 2026 12:08:32 -0800 Subject: [PATCH] fix(freshness): fail the run when no App token was minted The org never shared FLEET_APP_PRIVATE_KEY with this repo, so the mint step skipped on HAS_APP_KEY=false and the PR step fell back to GITHUB_TOKEN. GitHub starts no workflow for a PR that token opens, so ci.yml's required contexts never arrived and #16 sat BLOCKED behind a green run until it was closed and reopened by hand. The key is shared now and the bot's PRs are App-authored (#17). A last step reds the run if the mint ever yields no token again, after the PR step so the PR still opens, and names whether the key/variable or the App install is the missing half. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/freshness.yml | 22 ++++++++++++++++++++++ CHANGELOG.md | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/.github/workflows/freshness.yml b/.github/workflows/freshness.yml index a8e335c..20895f9 100644 --- a/.github/workflows/freshness.yml +++ b/.github/workflows/freshness.yml @@ -125,3 +125,25 @@ jobs: Let ci.yml run: it installs these exact pins with \`:Lazy! restore\`, starts the editor and runs \`:checkhealth gerrrt\`. That is the check this bump did not have while the tree lived in dotfiles-core." fi + + # The mint above is continue-on-error and the PR step falls back to GITHUB_TOKEN, so a + # key the org never shared with this repo, or an App not installed on it, used to leave + # this run GREEN while the PR it opened sat BLOCKED: GitHub starts no workflow for a PR + # that GITHUB_TOKEN opens, so ci.yml's required contexts never arrive (#16). Fail AFTER + # the PR step rather than before it: the PR still opens and can be nudged by hand, and + # the red run is the report. The same step closes Core's freshness.yml jobs; + # dotfiles-core's GITHUB-APP-AUTH.md, "A self-PR repo has a third registration". + - name: Fail if the App token was not minted + if: env.MODE == 'pr' && steps.app.outputs.token == '' + env: + APP_OUTCOME: ${{ steps.app.outcome }} + HAS_CLIENT_ID: ${{ vars.FLEET_APP_CLIENT_ID != '' }} + run: | + if [ "$HAS_APP_KEY" != true ] || [ "$HAS_CLIENT_ID" != true ]; then + why="FLEET_APP_PRIVATE_KEY visible: $HAS_APP_KEY, FLEET_APP_CLIENT_ID visible: $HAS_CLIENT_ID — share the org secret/variable with ${GITHUB_REPOSITORY}" + else + why="the mint ran and ended '${APP_OUTCOME}' — is dotgibson-fleet-sync installed on ${GITHUB_REPOSITORY}?" + fi + echo "::error title=PR not App-authored::No App token was minted, so any PR this job opened is GITHUB_TOKEN-authored and its CI will not start: $why" + { echo "### ❌ no App token — any PR opened here will sit BLOCKED"; echo ""; echo "$why"; } >> "$GITHUB_STEP_SUMMARY" + exit 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b4bdd..9acdfe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ verbatim as the GitHub Release body, so a version with an empty section refuses ## [Unreleased] +### Fixed + +- **The freshness bot fails when it cannot mint the fleet App token, instead of opening a + refresh PR whose CI never starts.** The org's `FLEET_APP_PRIVATE_KEY` was never shared + with this repo, so the mint step skipped, the PR step fell back to `GITHUB_TOKEN`, and + GitHub — which starts no workflow for a PR that token opens — never delivered `ci.yml`'s + six required contexts. The run stayed green and #16 sat `BLOCKED` until it was closed and + reopened by hand. With the key shared, the bot's PRs are App-authored again (#17); the new + last step reds the run if that ever stops, naming whether the key or the App install is + missing, so a missing install or key shows up as a red run rather than another stuck PR. + ### Security - **CI pins Core's `setup-core-tools` action to a commit, so GitHub can enforce SHA pinning