Skip to content

Commit fcf862c

Browse files
sweetcoder-limc0201-github
authored andcommitted
build: adjust homebrew checkout depth and git commit handling
1 parent a61f63f commit fcf862c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

.github/workflows/homebrew.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
steps:
3737
- name: Checkout code
3838
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
3941

4042
- name: Setup Go
4143
uses: actions/setup-go@v4
@@ -425,12 +427,8 @@ jobs:
425427
def install
426428
# Set build variables matching the Makefile
427429
version = self.version
428-
# Handle git commit safely (archive tarball doesn't have .git directory)
429-
git_commit = begin
430-
Utils.safe_popen_read("git", "rev-parse", "--short", "HEAD").chomp
431-
rescue
432-
"unknown"
433-
end
430+
# Use embedded git commit from build time (since tarball has no .git directory)
431+
git_commit = "$GIT_COMMIT"
434432
build_date = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
435433
436434
# Set Go proxy for better network connectivity (especially in China)
@@ -470,6 +468,7 @@ jobs:
470468
# Replace placeholders with actual values
471469
sed -i "s/\$VERSION/$VERSION/g" homebrew/agb.rb
472470
sed -i "s/\$SOURCE_SHA256/$SOURCE_SHA256/g" homebrew/agb.rb
471+
sed -i "s/\$GIT_COMMIT/$GIT_COMMIT/g" homebrew/agb.rb
473472
sed -i "s|\${{ github.repository }}|${{ github.repository }}|g" homebrew/agb.rb
474473
475474
echo "✅ Official Homebrew formula created at homebrew/agb.rb"

0 commit comments

Comments
 (0)