Skip to content

Commit 5b87d2d

Browse files
authored
Merge pull request #2652 from jandubois/clone-homebrew
Get qemu bottle commit from git checkout
2 parents cb319e1 + a1662f3 commit 5b87d2d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/test.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,14 @@ jobs:
379379
- uses: actions/checkout@v4
380380
with:
381381
fetch-depth: 0
382+
- name: Fetch homebrew-core commit messages
383+
uses: actions/checkout@v4
384+
with:
385+
# needed by ./hack/brew-install-version.sh
386+
repository: homebrew/homebrew-core
387+
path: homebrew-core
388+
fetch-depth: 0
389+
filter: tree:0
382390
- uses: actions/setup-go@v5
383391
with:
384392
go-version: 1.23.x
@@ -387,9 +395,6 @@ jobs:
387395
with:
388396
template: https://raw.githubusercontent.com/lima-vm/lima/${{ matrix.oldver }}/examples/ubuntu-lts.yaml
389397
- name: Install test dependencies
390-
env:
391-
# brew-install-version.sh calls `gh`, which needs the token
392-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
393398
run: |
394399
brew install bash coreutils
395400
# QEMU 9.1.0 seems to break on GitHub runners, both on Monterey and Ventura

hack/brew-install-version.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
2-
# This script only works for formulas in the homebrew-core
2+
# This script only works for formulas in the homebrew-core.
3+
# It assumes the homebrew-core has been checked out into ./homebrew-core.
4+
# It only needs commit messages, so the checkout can be filtered with tree:0.
35

46
set -eu -o pipefail
57

@@ -15,8 +17,8 @@ if ! brew tap | grep -q "^${TAP}\$"; then
1517
brew tap-new "$TAP"
1618
fi
1719

18-
# Get the commit id for the commit that updated this bottle
19-
SHA=$(gh search commits --repo homebrew/homebrew-core "${FORMULA}: update ${VERSION} bottle" --json sha --jq "last|.sha")
20+
# Get the latest commit id for the commit that updated this bottle
21+
SHA=$(git -C homebrew-core log --max-count 1 --grep "^${FORMULA}: update ${VERSION} bottle" --format="%H")
2022
if [[ -z $SHA ]]; then
2123
echo "${FORMULA} ${VERSION} not found"
2224
exit 1

0 commit comments

Comments
 (0)