Skip to content

Commit bc6b2e2

Browse files
committed
chore: Enhance commit-scoop-manifest script with error handling and ensure correct branch for pushing changes
1 parent 857c306 commit bc6b2e2

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19+
token: ${{ secrets.GITHUB_TOKEN }}
1920

2021
- name: Setup Go
2122
uses: actions/setup-go@v4

scripts/commit-scoop-manifest.ps1

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,34 @@ if (Test-Path 'zed-cli-win-unofficial.json') {
44
Write-Host "✅ Found fixed manifest: zed-cli-win-unofficial.json"
55
Write-Host " Size: $((Get-Item 'zed-cli-win-unofficial.json').Length) bytes"
66

7+
# Debug: Show git status
8+
Write-Host "🔍 Git status:"
9+
git status
10+
git branch -a
11+
712
# Configure git user (required for commits)
813
git config user.name "SameerJS6"
914
git config user.email "[email protected]"
1015

16+
# For tag-based workflows, we need to checkout the main branch
17+
Write-Host "🔄 Ensuring we're on the main branch..."
18+
git fetch origin main
19+
git checkout main
20+
if ($LASTEXITCODE -ne 0) {
21+
Write-Host "❌ Failed to checkout main branch"
22+
exit 1
23+
}
24+
25+
# Get the current branch name
26+
$currentBranch = git branch --show-current
27+
Write-Host "📋 Current branch: $currentBranch"
28+
1129
# Add the fixed manifest file
1230
git add zed-cli-win-unofficial.json
31+
if ($LASTEXITCODE -ne 0) {
32+
Write-Host "❌ Failed to add file to git staging"
33+
exit 1
34+
}
1335
Write-Host "📝 Added file to git staging"
1436

1537
# Check if there are changes to commit
@@ -18,11 +40,19 @@ if (Test-Path 'zed-cli-win-unofficial.json') {
1840
# Commit with descriptive message
1941
$commitMessage = "Scoop update for zed-cli-win-unofficial version ${env:GITHUB_REF_NAME} with zed.bat"
2042
git commit -m $commitMessage
43+
if ($LASTEXITCODE -ne 0) {
44+
Write-Host "❌ Failed to commit changes"
45+
exit 1
46+
}
2147
Write-Host "✅ Committed changes with message: '$commitMessage'"
2248

23-
# Push to main branch
24-
git push origin main
25-
Write-Host "🚀 Pushed changes to main branch"
49+
# Push to the current branch
50+
git push origin $currentBranch
51+
if ($LASTEXITCODE -ne 0) {
52+
Write-Host "❌ Failed to push changes to $currentBranch"
53+
exit 1
54+
}
55+
Write-Host "🚀 Pushed changes to $currentBranch branch"
2656

2757
Write-Host ""
2858
Write-Host "🎉 Successfully updated scoop manifest!"

0 commit comments

Comments
 (0)