Skip to content

Commit 53eb143

Browse files
committed
ci: harden promotion pull request updates
1 parent 710780c commit 53eb143

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/stlc-promote.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ jobs:
7070
GH_TOKEN: ${{ steps.production-token.outputs.token }}
7171
PRODUCTION_REPO: kernel/kernel-python-sdk
7272
run: |
73-
existing=$(gh pr list --repo "$PRODUCTION_REPO" --head stainless/release --state open --json number --jq '.[0].number')
73+
body=$(mktemp)
74+
git log --oneline production/main..origin/main > "$body"
75+
existing=$(gh pr list --repo "$PRODUCTION_REPO" --head stainless/release --state open --json number --jq 'if length == 0 then "" else .[0].number end')
7476
if [ -z "$existing" ]; then
75-
gh pr create --repo "$PRODUCTION_REPO" --base main --head stainless/release --title "Release SDK updates" --body "$(git log --oneline production/main..origin/main)"
77+
gh pr create --repo "$PRODUCTION_REPO" --base main --head stainless/release --title "Release SDK updates" --body-file "$body"
78+
else
79+
gh pr edit "$existing" --repo "$PRODUCTION_REPO" --title "Release SDK updates" --body-file "$body"
80+
fi
81+
if ! gh pr merge stainless/release --repo "$PRODUCTION_REPO" --merge --auto; then
82+
echo "::warning title=Manual promotion required::Merge the promote PR with a merge commit."
7683
fi
77-
gh pr merge stainless/release --repo "$PRODUCTION_REPO" --merge --auto || echo "Auto-merge unavailable; merge the promote PR manually with a merge commit."

0 commit comments

Comments
 (0)