ci(update-marketplace): auto-merge the snapshot PR#45
Conversation
The release pipeline split into two paths: npm publish (runs and ships to the registry) and marketplace snapshot (opens a PR against sendbird/codex-marketplace). Until now the marketplace step stopped at PR creation, so every release sat in PR limbo until a human noticed and merged it. We forgot v1.2.0 for half an hour the same way. Capture the PR number after create/reuse and run `gh pr merge --squash --admin --delete-branch` against it with the marketplace push token. Auto-snapshot PRs are deterministic from the source tag, so admin bypass of branch protection is appropriate here. If the token does not have admin rights on the marketplace repo, the merge step fails loudly and the open PR remains for manual recovery — strictly better than the current behavior of leaving it open forever. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ef97428c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| PR_NUMBER=$(gh pr list \ | ||
| --repo "$MARKETPLACE_REPO" \ | ||
| --head "$BRANCH_NAME" \ | ||
| --json number \ | ||
| --jq '.[0].number // empty') |
There was a problem hiding this comment.
Fail when PR lookup returns empty after creation
After creating a PR, the workflow re-fetches it with gh pr list and then unconditionally exports pr_number even if that query returns empty. The merge step is gated on pr_number != '', so an empty lookup makes the job succeed without merging and reintroduces the “PR left open forever” behavior this change is trying to eliminate. gh pr create already reports the created PR URL; at minimum, assert PR_NUMBER is non-empty and exit 1 when it is not so the run fails loudly instead of silently skipping merge.
Useful? React with 👍 / 👎.
Summary
The marketplace update workflow currently stops at `gh pr create` — every release lands on npm immediately but the corresponding marketplace snapshot PR sits open until a human notices and merges. v1.2.0 sat for ~30 minutes that way.
Capture the PR number (whether newly created or already open from a prior run) and run `gh pr merge --squash --admin --delete-branch` against it with the same marketplace push token. Auto-snapshot PRs are deterministic from the source tag, so admin bypass of branch protection is appropriate here. If the token lacks admin rights the merge step fails loudly and the open PR remains for manual recovery — strictly better than the current silent forget-forever behavior.
Test plan
🤖 Generated with Claude Code