Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/bump-homebrew.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
name: Bump Homebrew Formula

# Triggers when a CLI release (tag matching cli-v*) is published, computes
# SHA256 for each platform tarball, and pushes an updated formula to the
# superset-sh/homebrew-tap repository.
# Renders the superset.rb formula for a published CLI release and pushes it to
# the superset-sh/homebrew-tap repository. Invoked as a reusable job from
# release-cli.yml (needs: release) so the bump runs in the same workflow run as
# the release. It is NOT driven by `release: published` because a release
# auto-created by the workflow's GITHUB_TOKEN does not emit an event that can
# trigger another workflow. workflow_dispatch is the manual escape hatch to
# re-bump a specific tag.

on:
release:
types: [published]
workflow_call:
inputs:
tag:
description: "CLI release tag (cli-v<semver>)"
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: "CLI release tag (cli-v<semver>)"
required: true
type: string

# Serialize runs so two concurrent releases can't race and drop a bump.
concurrency:
Expand All @@ -15,13 +29,12 @@ concurrency:

jobs:
bump:
if: startsWith(github.event.release.tag_name, 'cli-v')
runs-on: ubuntu-latest
steps:
- name: Extract version from tag
id: version
env:
TAG: ${{ github.event.release.tag_name }}
TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
# Validate tag format: cli-v<semver>. Rejects tags with shell metacharacters.
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Release CLI

# Fires on cli-v* tag push. Builds the full 3-target matrix and publishes
# a draft GitHub Release plus a rolling cli-latest pointer. workflow_dispatch
# is the manual escape hatch for testing the full pipeline without cutting
# a tag (the release job is gated to tag pushes only).
# Fires on cli-v* tag push. Builds the full 3-target matrix, publishes a
# prerelease GitHub Release plus a rolling cli-latest pointer, then bumps the
# Homebrew formula. workflow_dispatch is the manual escape hatch for testing
# the full pipeline without cutting a tag (the release job is gated to tag
# pushes only).
Comment on lines +5 to +7
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Adjust the workflow_dispatch comment to match behavior.

Lines 5-7 say manual dispatch tests the “full pipeline,” but release and bump-homebrew are both gated to refs/tags/cli-v*, so dispatch currently runs build-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release-cli.yml around lines 5 - 7, Update the comment
referencing workflow_dispatch to accurately state that manual dispatch does not
trigger the full pipeline; clarify that workflow_dispatch only runs the build
step because the release and bump-homebrew jobs are gated to tag pushes
(refs/tags/cli-v*). Edit the comment mentioning workflow_dispatch so it explains
it is a manual build-only escape hatch for testing and not a way to run the
release or bump-homebrew jobs.


on:
push:
Expand Down Expand Up @@ -79,3 +80,16 @@ jobs:
--notes "Rolling pointer to the latest published CLI release. See [${VERSION_TAG}](https://github.com/${{ github.repository }}/releases/tag/${VERSION_TAG}) for changelog." \
--target "${{ github.sha }}" \
--prerelease

bump-homebrew:
# Chained here instead of triggering on `release: published`: the release
# above is created with GITHUB_TOKEN, and GitHub does not fire workflow
# triggers for events generated by GITHUB_TOKEN, so an event-driven bump
# never runs. needs: release guarantees the tarballs are published first.
name: Bump Homebrew Formula
needs: release
if: startsWith(github.ref, 'refs/tags/cli-v')
uses: ./.github/workflows/bump-homebrew.yml
with:
tag: ${{ github.ref_name }}
secrets: inherit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Narrow secret scope for the reusable workflow call.

Line 95 inherits all available secrets into the called workflow. Pass only HOMEBREW_TAP_TOKEN to reduce blast radius.

🔐 Proposed least-privilege change
# .github/workflows/release-cli.yml
   bump-homebrew:
@@
-    secrets: inherit
+    secrets:
+      HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
# .github/workflows/bump-homebrew.yml
 on:
   workflow_call:
     inputs:
       tag:
         description: "CLI release tag (cli-v<semver>)"
         required: true
         type: string
+    secrets:
+      HOMEBREW_TAP_TOKEN:
+        required: true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release-cli.yml at line 95, Replace the broad "secrets:
inherit" on the reusable workflow call with a least-privilege secrets mapping
that passes only the HOMEBREW_TAP_TOKEN to the called workflow; find the
reusable workflow invocation where "secrets: inherit" appears and change it to
explicitly map HOMEBREW_TAP_TOKEN from the caller's secrets so no other secrets
are forwarded.

Loading