@gurupanguji

Summary

Keep the social publisher’s posting behavior unchanged and fix only the metadata PR merge tail.

Problem

The Publish Social Snippets workflow can successfully:

but still fail in the final step when it always runs gh pr merge --auto --squash.

That command is correct when branch protection is still blocking merge, but it fails when the PR is already in a clean, directly mergeable state. The result is a false-negative workflow run after real side effects have already happened.

Decision

Move the merge decision into a small helper script that inspects PR state and chooses one of two modes:

The workflow will:

  1. create or update the metadata PR
  2. ask the helper which merge mode to use
  3. run gh pr merge --squash for direct
  4. run gh pr merge --auto --squash for auto

Expected Outcome

Risks

Mitigation

Keep the helper narrow, cover the clean-vs-blocked cases with unit tests, and fail closed on unknown states so the workflow does not silently do the wrong thing.