Repository navigation
fix(sync): open a PR when direct push to a protected branch is rejected - #8
Merged
Merged
Conversation
The clean-merge path ran 'git push origin <branch>' without checking its exit status (the script uses 'set -uo pipefail' without -e), so a push rejected by a 'require pull request' rule was logged as a successful sync. Callers with protected branches silently stopped syncing. Now a rejected push falls back to pushing the merge to sync-<branch>-<ts> and opening a PR (skipped if one is already open). Failures to push or to create the PR fail the job instead of reporting success.
nborges-aws
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
reusable-sync-from-public.ymlpushes clean merges straight to the target branch, but never checks whether that push succeeded (the step runs withset -uo pipefail, no-e). When the caller's branch has a "changes must be made through a pull request" rule, the push is rejected withGH013, and the job still logs✅ main synced successfullyand exits 0.This is happening today in
aws/private-agentcore-cli-staging: every 6-hourly run since late September has "succeeded" whilemainfell 13 commits behindaws/agentcore-cli.Fix
sync-<branch>-<timestamp>and open a PR into<branch>. Skip if an opensync-<branch>-*PR already exists (same dedupe pattern as the conflict path).Testing
actionlint(with shellcheck): no new findings; the one remaining SC2155 warning was already there.gh:main(pre-receive hook rejecting pushes): opens a PR fromsync-main-*, private.github/workflows/retained, rc=0main+gh pr createfailing: rc=1 with::error::main: direct push, rc=0 (unchanged)Callers pin this workflow by SHA, so nothing changes for them until they bump the pin.