Skip to content

Commit 71ce47a

Browse files
committed
fix: resolve git revision error in release automation workflow
- Add explicit main branch fetch to make it available for git comparisons - Change main..HEAD to origin/main..HEAD in git log and rev-list commands - Fix fatal: ambiguous argument 'main..HEAD' unknown revision error - Ensure proper branch comparison for PR creation and updates
1 parent 2001396 commit 71ce47a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/release-automation.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jobs:
2727
fetch-depth: 0
2828
token: ${{ secrets.GITHUB_TOKEN }}
2929

30+
- name: Fetch main branch
31+
run: |
32+
echo "🔄 Fetching main branch for comparison..."
33+
git fetch origin main:main
34+
echo "✅ Main branch fetched successfully"
35+
3036
- name: Extract version and type from branch name
3137
id: branch_info
3238
run: |
@@ -97,8 +103,8 @@ jobs:
97103
LABEL="${{ steps.branch_info.outputs.label }}"
98104
99105
# Generate commit summary for the PR description
100-
COMMITS=$(git log --oneline main..HEAD | head -10)
101-
COMMIT_COUNT=$(git rev-list --count main..HEAD)
106+
COMMITS=$(git log --oneline origin/main..HEAD | head -10)
107+
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
102108
103109
gh pr create \
104110
--base main \
@@ -149,8 +155,8 @@ jobs:
149155
echo "🔄 Updating existing PR #$PR_NUMBER with latest changes"
150156
151157
# Generate commit summary for the PR description
152-
COMMITS=$(git log --oneline main..HEAD | head -10)
153-
COMMIT_COUNT=$(git rev-list --count main..HEAD)
158+
COMMITS=$(git log --oneline origin/main..HEAD | head -10)
159+
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
154160
155161
gh pr edit "$PR_NUMBER" \
156162
--title "$TYPE: $VERSION" \

0 commit comments

Comments
 (0)