From dced9cd0e6730a27c19d560e620368d03cfdb1c6 Mon Sep 17 00:00:00 2001 From: Chris Hirsch Date: Thu, 19 Nov 2026 11:02:32 -0700 Subject: [PATCH 1/3] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20show=20brew=20errors?= =?UTF-8?q?=20and=20tap=20trust=20in=20brewfile=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/lint.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 63f6c2e..9c80777 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -63,17 +63,27 @@ jobs: while read -r t; do brew tap "$t" || echo "::error::tap \"$t\" failed to add" done < /tmp/taps.txt + - name: Show Homebrew version and third-party tap trust + run: | + brew --version + brew tap-info --installed --json | + jq -r '.[] | select(.official | not) | "\(.name) trusted=\(if has("trusted") then .trusted else "n/a" end)"' - name: Verify every brew/cask entry resolves to a real formula/cask run: | # Short-name lookup can miss formulas from a tap added moments ago # (name-resolution cache isn't warm yet), so fall back to checking - # every tapped repo explicitly by fully-qualified name. + # every tapped repo explicitly by fully-qualified name. On failure, + # print brew's error for the name as written, then the first line + # of each tap-qualified attempt. resolves() { - local kind=$1 name=$2 - brew info "--$kind" "$name" >/dev/null 2>&1 && return 0 + local kind=$1 name=$2 err t + err=$(brew info "--$kind" "$name" 2>&1 >/dev/null) && return 0 + local errs=" $name: ${err//$'\n'/$'\n' }"$'\n' while read -r t; do - brew info "--$kind" "$t/$name" >/dev/null 2>&1 && return 0 + err=$(brew info "--$kind" "$t/$name" 2>&1 >/dev/null) && return 0 + errs+=" $t/$name: ${err%%$'\n'*}"$'\n' done < /tmp/taps.txt + printf '%s' "$errs" return 1 } fail=0 From 17e02d44f8213814ac6e7c3ecfc0dbfd2f5118ac Mon Sep 17 00:00:00 2001 From: Chris Hirsch Date: Thu, 19 Nov 2026 12:06:14 -0700 Subject: [PATCH 2/3] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20run=20brewfile=20check?= =?UTF-8?q?=20on=20ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9c80777..fc37efc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -48,9 +48,12 @@ jobs: brewfile-check: name: Brewfile name validation - runs-on: macos-latest + # Only resolves names, so Linux Homebrew (preinstalled, not on PATH) is enough + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Put Homebrew on PATH + run: echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH" - name: Tap all taps referenced in Brewfile run: | { From 4d24a264f89a2f1fe82ac2a779cbf119ccccaed0 Mon Sep 17 00:00:00 2001 From: Chris Hirsch Date: Thu, 19 Nov 2026 14:31:15 -0700 Subject: [PATCH 3/3] =?UTF-8?q?ci:=20=F0=9F=90=9B=20trust=20brewfile=20tap?= =?UTF-8?q?s=20before=20resolving=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Homebrew 7.0.13 refuses to load formulae and casks from untrusted third-party taps, so every tap entry failed to resolve. --- .github/workflows/lint.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fc37efc..5c63702 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -63,30 +63,29 @@ jobs: sed -n 's/^brew "\([^/"]*\/[^/"]*\)\/[^"]*".*/\1/p' Brewfile sed -n 's/^cask "\([^/"]*\/[^/"]*\)\/[^"]*".*/\1/p' Brewfile } | sort -u > /tmp/taps.txt + brew --version + # Homebrew refuses to load formulae and casks from untrusted + # third-party taps, so trust each tap after adding it. while read -r t; do - brew tap "$t" || echo "::error::tap \"$t\" failed to add" + if brew tap "$t"; then + brew trust --tap "$t" || echo "::error::tap \"$t\" could not be trusted" + else + echo "::error::tap \"$t\" failed to add" + fi done < /tmp/taps.txt - - name: Show Homebrew version and third-party tap trust - run: | - brew --version - brew tap-info --installed --json | - jq -r '.[] | select(.official | not) | "\(.name) trusted=\(if has("trusted") then .trusted else "n/a" end)"' - name: Verify every brew/cask entry resolves to a real formula/cask run: | # Short-name lookup can miss formulas from a tap added moments ago # (name-resolution cache isn't warm yet), so fall back to checking # every tapped repo explicitly by fully-qualified name. On failure, - # print brew's error for the name as written, then the first line - # of each tap-qualified attempt. + # print brew's error for the name as written. resolves() { local kind=$1 name=$2 err t err=$(brew info "--$kind" "$name" 2>&1 >/dev/null) && return 0 - local errs=" $name: ${err//$'\n'/$'\n' }"$'\n' while read -r t; do - err=$(brew info "--$kind" "$t/$name" 2>&1 >/dev/null) && return 0 - errs+=" $t/$name: ${err%%$'\n'*}"$'\n' + brew info "--$kind" "$t/$name" >/dev/null 2>&1 && return 0 done < /tmp/taps.txt - printf '%s' "$errs" + printf ' %s\n' "${err//$'\n'/$'\n' }" return 1 } fail=0