diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml new file mode 100644 index 0000000..540e198 --- /dev/null +++ b/.github/workflows/stlc-promote.yml @@ -0,0 +1,37 @@ +# Promote stage — install this file at .github/workflows/stlc-promote.yml in +# EACH SDK repo (linq-go, linq-node, linq-python). It is repo-agnostic. +# +# linq-sdks' "Build SDKs" workflow force-pushes regenerated code to the +# `stainless/release` branch here. This workflow turns that branch into a +# release PR against main. The force-push updates an already-open PR in place, +# so this only needs to create the PR the first time. +# +# Auth: the org-level STLC_ACTIONS_PAT secret (same PAT linq-sdks uses). A PAT, +# not GITHUB_TOKEN, so the release PR triggers this repo's CI checks. + +name: Open release PR + +on: + push: + branches: [stainless/release] + +jobs: + promote: + runs-on: ubuntu-latest + steps: + - name: Open or update the release PR + env: + GH_TOKEN: ${{ secrets.STLC_ACTIONS_PAT }} + REPO: ${{ github.repository }} + run: | + EXISTING=$(gh pr list --repo "$REPO" \ + --head stainless/release --base main --state open \ + --json number --jq '.[0].number // empty') + if [ -n "$EXISTING" ]; then + echo "Release PR #${EXISTING} already open — the force-push updated it." + exit 0 + fi + gh pr create --repo "$REPO" \ + --base main --head stainless/release \ + --title "Release: regenerated SDK" \ + --body "Regenerated by stlc from an updated API spec. Review the diff and merge to cut a release (release-please versions and publishes on merge)."