Skip to content

Commit 4d37430

Browse files
committed
fix(ci): replace mislav action with custom homebrew update script
The mislav/bump-homebrew-formula-action is incompatible with GitHub App tokens (requires /user endpoint). Replace with custom script that: - Downloads source tarball and calculates SHA256 - Updates formula via GitHub API - Works with GitHub App authentication
1 parent f93f643 commit 4d37430

1 file changed

Lines changed: 48 additions & 12 deletions

File tree

.github/workflows/release.yaml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,52 @@ jobs:
274274
repositories: homebrew-sx
275275

276276
- name: Update Homebrew formula
277-
uses: mislav/bump-homebrew-formula-action@v3
278-
with:
279-
formula-name: sx
280-
homebrew-tap: agentic-dev3o/homebrew-sx
281-
tag-name: v${{ needs.validate.outputs.version }}
282-
create-pullrequest: false
283-
create-branch: false
284-
commit-message: |
285-
{{formulaName}} {{version}}
286-
287-
Created by https://github.com/mislav/bump-homebrew-formula-action
288277
env:
289-
COMMITTER_TOKEN: ${{ steps.app-token.outputs.token }}
278+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
279+
run: |
280+
set -e
281+
282+
VERSION="${{ needs.validate.outputs.version }}"
283+
REPO="agentic-dev3o/sandbox-shell"
284+
TAP_REPO="agentic-dev3o/homebrew-sx"
285+
286+
echo "==> Updating formula to version ${VERSION}"
287+
288+
# Download source tarball and calculate SHA256
289+
TARBALL_URL="https://github.com/${REPO}/archive/refs/tags/v${VERSION}.tar.gz"
290+
echo "==> Downloading ${TARBALL_URL}"
291+
292+
HTTP_CODE=$(curl -sL -w "%{http_code}" -o /tmp/source.tar.gz "$TARBALL_URL")
293+
if [ "$HTTP_CODE" != "200" ]; then
294+
echo "Error: Failed to download tarball (HTTP ${HTTP_CODE})"
295+
exit 1
296+
fi
297+
298+
SHA256=$(shasum -a 256 /tmp/source.tar.gz | cut -d' ' -f1)
299+
echo "==> SHA256: ${SHA256}"
300+
301+
# Get current formula
302+
echo "==> Fetching current formula"
303+
gh api "repos/${TAP_REPO}/contents/Formula/sx.rb" --jq '.content' | base64 -d > /tmp/formula.rb
304+
305+
# Update version and SHA256 in formula
306+
echo "==> Updating formula"
307+
sed -i -E "s|url \"https://github.com/${REPO}/archive/refs/tags/v[^\"]+\.tar\.gz\"|url \"${TARBALL_URL}\"|" /tmp/formula.rb
308+
sed -i -E "s|sha256 \"[a-f0-9]+\"|sha256 \"${SHA256}\"|" /tmp/formula.rb
309+
310+
# Get current file SHA (needed for update)
311+
FILE_SHA=$(gh api "repos/${TAP_REPO}/contents/Formula/sx.rb" --jq '.sha')
312+
echo "==> Current file SHA: ${FILE_SHA}"
313+
314+
# Commit updated formula
315+
echo "==> Committing changes"
316+
CONTENT_BASE64=$(base64 -w 0 /tmp/formula.rb)
317+
318+
gh api "repos/${TAP_REPO}/contents/Formula/sx.rb" \
319+
-X PUT \
320+
-f message="sx ${VERSION}" \
321+
-f content="${CONTENT_BASE64}" \
322+
-f sha="$FILE_SHA" \
323+
-f branch="main"
324+
325+
echo "==> Formula updated successfully"

0 commit comments

Comments
 (0)