Skip to content

feat: Homebrew tap auto-update on release + brew install instructions#313

Merged
PureWeen merged 4 commits intomainfrom
homebrew-tap
Mar 9, 2026
Merged

feat: Homebrew tap auto-update on release + brew install instructions#313
PureWeen merged 4 commits intomainfrom
homebrew-tap

Conversation

@StephaneDelcroix
Copy link
Copy Markdown
Collaborator

Changes

  • build.yml: Adds two steps to create-release job:

    • Compute Mac SHA256 — hashes PolyPilot.zip for the cask
    • Update Homebrew tap — dispatches release-published event to PureWeen/homebrew-tap with version + SHA256 (skipped for prereleases)
  • README.md: Adds Install with Homebrew section (brew tap PureWeen/tap && brew install --cask polypilot) and fixes the Copilot CLI install command

Homebrew Tap

The tap at PureWeen/homebrew-tap is already set up with:

  • brew install --cask polypilot — Mac Catalyst GUI app (auto-installs copilot-cli as a dependency)
  • brew install polypilot-console — Cross-platform CLI
  • Auto-update workflow triggered by this PR's dispatch step

Setup Required

Add a HOMEBREW_TAP_TOKEN secret to this repo — a fine-grained PAT scoped to PureWeen/homebrew-tap with Contents: Read and write permission.

StephaneDelcroix and others added 4 commits March 8, 2026 19:45
…ctions

- Add 'Compute Mac SHA256' and 'Update Homebrew tap' steps to
  create-release job in build.yml — dispatches to PureWeen/homebrew-tap
  on non-prerelease tags with version + SHA256
- Add 'Install with Homebrew' section to README with brew tap/install
- Fix Copilot CLI install instruction (npm install -g @github/copilot)

Requires HOMEBREW_TAP_TOKEN secret with repo scope on PureWeen/PolyPilot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…w tap step

- Add continue-on-error: true to prevent tap failure from killing release job
- Add if-guard to skip step when HOMEBREW_TAP_TOKEN is not set
- Use --input heredoc for proper nested JSON in client_payload

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Step-level env vars are not available in the same step's if condition
evaluation. Use secrets.HOMEBREW_TAP_TOKEN directly in the if expression
which is the correct GitHub Actions pattern for optional-secret guards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen
Copy link
Copy Markdown
Owner

PureWeen commented Mar 8, 2026

PR #313 Re-Review Report — Post-Fix (5-Model Consensus)

CI Status: ⚠️ Not yet run on latest push (2 fix commits added)


Previous Findings Status

# Original Finding Status
1 🔴 CRITICAL: No continue-on-error: true → tap failure kills release job FIXEDcontinue-on-error: true added (5/5 models confirmed)
2 🟡 MODERATE: Empty HOMEBREW_TAP_TOKEN causes gh auth 401 FIXEDsecrets.HOMEBREW_TAP_TOKEN != '' guard in if condition (see note below)
3 🟡 MODERATE: gh api -f bracket notation produces flat JSON keys FIXED — Replaced with --input - <<EOF heredoc with well-formed JSON (5/5 models confirmed)
4 🟢 MINOR: Compute Mac SHA256 step runs on prereleases ⚠️ STILL PRESENT — No prerelease guard on the SHA256 step; harmless (output is never consumed on prereleases)

Fix Note: env context correction

The initial fix used env.HOMEBREW_TAP_TOKEN != '' in the if condition with the token set only in the step-level env: block. 4/5 review models flagged that step-level env vars may not be available in the same step's if evaluation. A follow-up commit corrected this to use secrets.HOMEBREW_TAP_TOKEN != '' directly in the if expression — the canonical GitHub Actions pattern for optional-secret guards — avoiding any ambiguity.


Final State of build.yml

- name: Update Homebrew tap
  if: "!contains(github.ref, '-') && secrets.HOMEBREW_TAP_TOKEN != ''"
  continue-on-error: true
  env:
    GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
  run: |
    VERSION="${GITHUB_REF#refs/tags/v}"
    MAC_SHA256="${{ steps.mac_sha.outputs.sha256 }}"
    gh api repos/PureWeen/homebrew-tap/dispatches \
      --method POST --input - <<EOF
    {"event_type":"release-published","client_payload":{"version":"$VERSION","mac_sha256":"$MAC_SHA256"}}
    EOF

Test Coverage

No test coverage exists for CI workflow logic (standard for GitHub Actions workflows). The changes are self-contained to the release pipeline.


Recommended Action: ✅ Approve

All critical and moderate findings from the initial review are resolved. The only remaining item (SHA256 step runs on prereleases) is harmless. The PR is ready to merge.

@PureWeen PureWeen merged commit 19355b7 into main Mar 9, 2026
@PureWeen PureWeen deleted the homebrew-tap branch March 9, 2026 21:58
PureWeen added a commit that referenced this pull request Mar 10, 2026
The 'secrets.HOMEBREW_TAP_TOKEN' reference in the step-level 'if'
condition caused GitHub Actions to reject the entire workflow at
parse time (0 jobs created). Every push to main since PR #313 has
been broken by this.

Fix: remove the secrets check from the 'if' condition and instead
check the GH_TOKEN env var at runtime with a shell guard. Also
replace the indented heredoc (which wouldn't terminate properly)
with a piped echo for the JSON payload.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PureWeen added a commit that referenced this pull request Mar 10, 2026
…335)

## Problem

Every push to main since PR #313 (Homebrew tap auto-update) has failed
with **"This run likely failed because of a workflow file issue"** —
zero jobs created.

**Root cause:** The step-level `if` condition on the "Update Homebrew
tap" step used `secrets.HOMEBREW_TAP_TOKEN != ''`, which causes GitHub
Actions to reject the entire workflow at parse time.

## Fix

1. **Remove `secrets` from the `if` condition** — use a runtime shell
guard (`if [ -z "$GH_TOKEN" ]`) instead
2. **Replace indented heredoc with piped echo** — the original `EOF`
delimiter was indented (wouldn't terminate properly in a YAML block
scalar)

## Verification

- Last green build:
[#22873258217](https://github.com/PureWeen/PolyPilot/actions/runs/22873258217)
(before PR #313)
- First red build:
[#22876701610](https://github.com/PureWeen/PolyPilot/actions/runs/22876701610)
(PR #313 merge)
- All 16+ subsequent pushes to main have failed with the same workflow
parse error

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants