Skip to content

release: 1.24.0

release: 1.24.0 #14

name: Auto-merge release PRs
# Restores the retired Stainless cloud's hands-off release behavior: when
# release-please opens (or updates) its version/changelog PR on the production
# repo, enable auto-merge so it lands without a human. Squash is
# release-please's recommended merge strategy; the resulting new commit on
# production main comes back to staging via the back-sync.
#
# Sealed into the staging repos as custom code and reaches production via the
# promote; the `if` guard routes so only the production copy acts. Source of
# truth: dev-docs stainless/sdk-workflows/.
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
permissions:
contents: read
jobs:
automerge:
runs-on: runs-on=${{ github.run_id }}/image=ubuntu24-full-x64/runner=2cpu-linux-x64/spot=false/tag=sdk-release-automerge
if: >-
!endsWith(github.repository, '-staging') &&
startsWith(github.event.pull_request.head.ref, 'release-please--')
steps:
- name: Mint app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.STLC_APP_ID }}
private-key: ${{ secrets.STLC_APP_PRIVATE_KEY }}
- name: Enable auto-merge
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR: ${{ github.event.pull_request.number }}
run: |
# Auto-merge can only be enabled while the PR is blocked on
# requirements; on a repo with no required checks it errors, so fall
# back to merging directly — the same outcome auto-merge would have
# produced immediately.
if gh pr merge --auto --squash "$PR" --repo "$GITHUB_REPOSITORY"; then
echo "Auto-merge enabled for release PR #$PR."
else
gh pr merge --squash "$PR" --repo "$GITHUB_REPOSITORY"
echo "Merged release PR #$PR directly."
fi