Skip to content

Commit a53ae79

Browse files
authored
ci(desktop): merge release PR directly when mergeable, else auto-merge (#34)
The release version-bump PR step now checks the PR's mergeStateStatus: when CLEAN it squash-merges immediately, otherwise it falls back to enabling auto-merge. Shared merge args are factored into an array.
1 parent 3684038 commit a53ae79

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/desktop-release.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,30 @@ jobs:
533533
534534
echo "url=$pr_url" >> "$GITHUB_OUTPUT"
535535
536-
- name: Enable auto-merge
536+
- name: Merge or enable auto-merge
537537
env:
538538
GH_TOKEN: ${{ secrets.CI_BOT_PAT || github.token }}
539539
PR_URL: ${{ steps.version-pr.outputs.url }}
540540
RELEASE_TAG: ${{ needs.release_metadata.outputs.tag }}
541541
run: |
542542
set -euo pipefail
543543
544-
gh pr merge "$PR_URL" \
545-
--squash \
546-
--auto \
547-
--delete-branch \
544+
merge_state_status="$(gh pr view "$PR_URL" \
545+
--json mergeStateStatus \
546+
--jq '.mergeStateStatus')"
547+
548+
merge_args=(
549+
"$PR_URL"
550+
--squash
551+
--delete-branch
548552
--subject "chore(release): desktop ${RELEASE_TAG} [skip ci]"
553+
)
554+
555+
if [ "$merge_state_status" = "CLEAN" ]; then
556+
gh pr merge "${merge_args[@]}"
557+
else
558+
gh pr merge "${merge_args[@]}" --auto
559+
fi
549560
550561
dry-run-summary:
551562
name: Dry Run Summary

0 commit comments

Comments
 (0)