Skip to content

Commit 5453b22

Browse files
committed
fix(ci): Fix Homebrew cask update workflow variable passing and sed escaping
Issues fixed: 1. Move token parameter from env to checkout 'with:' section for proper auth 2. Use pipe (|) as sed delimiter instead of slash to handle URLs correctly 3. Consolidate environment variables in Update SAM cask step 4. Move DMG URL display to separate run block for clarity 5. Add explicit version output to env for commit step These changes ensure the workflow properly: - Authenticates with HOMEBREW_PAT token - Correctly updates version and SHA256 without sed parsing errors - Passes variables cleanly between steps - Successfully commits and pushes to homebrew-SAM repository
1 parent a15f0e2 commit 5453b22

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/update-homebrew-cask.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,34 +83,34 @@ jobs:
8383
uses: actions/checkout@v4
8484
with:
8585
repository: SyntheticAutonomicMind/homebrew-SAM
86-
env:
87-
VERSION: ${{ steps.version.outputs.version }}
88-
SHA256: ${{ steps.hash.outputs.sha256 }}
89-
DMG_URL: ${{ steps.asset.outputs.url }}
9086
token: ${{ secrets.HOMEBREW_PAT }}
9187
path: homebrew
9288

9389
- name: Update SAM cask
9490
working-directory: homebrew
91+
env:
92+
VERSION: ${{ steps.version.outputs.version }}
93+
SHA256: ${{ steps.hash.outputs.sha256 }}
9594
run: |
9695
echo "Updating Casks/sam.rb"
9796
echo " Version: $VERSION"
9897
echo " SHA256: $SHA256"
9998
10099
# Update the cask file with the new version and SHA256
100+
# Use | as sed delimiter to avoid conflicts with URL slashes
101101
sed -i.bak \
102102
-e "s|version \"[^\"]*\"|version \"$VERSION\"|" \
103103
-e "s|sha256 \"[^\"]*\"|sha256 \"$SHA256\"|" \
104104
Casks/sam.rb
105105
106-
env:
107-
VERSION: ${{ steps.version.outputs.version }}
108106
# Show the updated file
109107
echo "Updated Casks/sam.rb:"
110108
head -10 Casks/sam.rb
111109
112110
- name: Commit and push
113111
working-directory: homebrew
112+
env:
113+
VERSION: ${{ steps.version.outputs.version }}
114114
run: |
115115
git config user.name "github-actions[bot]"
116116
git config user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)