Keep the social publisher’s posting behavior unchanged and fix only the metadata PR merge tail.
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.
Move the merge decision into a small helper script that inspects PR state and chooses one of two modes:
direct when the PR is already clean and mergeableauto when the PR still needs branch protection requirements to completeThe workflow will:
gh pr merge --squash for directgh pr merge --auto --squash for autoKeep 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.