Skip to content

Port sync-branches as a composite action#11

Open
roborourke wants to merge 1 commit intomainfrom
consolidate-sync-branches
Open

Port sync-branches as a composite action#11
roborourke wants to merge 1 commit intomainfrom
consolidate-sync-branches

Conversation

@roborourke
Copy link
Copy Markdown

Summary

  • Adds .github/actions/sync-branches/action.yml — a composite/bash action that ports humanmade/sync-branches, replacing the deprecated node12 JS action with a gh CLI shell step that matches the conventions of every other action in this repo (no dist/, no npm dependencies)
  • Adds .github/actions/sync-branches/README.md — per-action docs with a usage example and notes on pairing with resolve-composer-lock-conflict
  • Adds .gitignore — ignores .worktrees/ so local worktrees don't appear as untracked files
  • Updates root README.md to include both the new sync-branches and the in-flight resolve-composer-lock-conflict action entries

Behaviour preserved verbatim from the upstream JS:

  • Removes the triggering label from the source PR before starting
  • Fails with a comment on the source PR if the sync branch already exists
  • Creates the sync branch at the source PR's head SHA
  • Skips creating a duplicate PR if one already exists between the same branch pair
  • Assigns the sync PR to the original PR author

What's changed vs upstream:

  • Input names are snake_case to match this repo's convention (from_branch, to_branch, etc.)
  • github_token defaults to ${{ github.token }} — callers only need to pass it when they need a PAT
  • Uses gh api / gh pr rather than @actions/github Octokit
  • No bundled dist/ — the step is a single inline bash script

Note

After this PR merges, consumers should migrate from humanmade/sync-branches@master to humanmade/hm-github-actions/.github/actions/sync-branches@<SHA> and update input names to snake_case.

Test plan

  • Label an open PR "Push to Dev" — confirm a {source}-dev branch and sync PR are created, label is removed, and the sync PR is assigned to the original author
  • Trigger again without deleting the sync branch — confirm a comment is posted on the source PR and the job fails
  • Label a PR where the label has already been manually removed — confirm the action exits cleanly without creating a sync PR
  • Pass pull_request_is_draft: "true" — confirm the sync PR is opened as a draft

🤖 Generated with Claude Code

Brings humanmade/sync-branches into this repo as a bash/composite action
(.github/actions/sync-branches) using the gh CLI, matching the conventions
of all other actions here. The JS runtime (node12, long deprecated) is
replaced with a single shell step — no dist/ or npm dependencies required.

Behaviour is preserved verbatim: removes the triggering label, fails with a
PR comment if the sync branch already exists, creates the branch at the
source PR's head SHA, opens the sync PR against the target branch, and
assigns it to the original PR author. The token input now defaults to
github.token so callers only need to override when a PAT is required.

Also adds .gitignore to exclude .worktrees/ from git tracking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant