From 619a05fb0a806b913ac03859abc6c2c627857353 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 25 Mar 2026 17:41:21 -0500 Subject: [PATCH] chore: remove on-child-update workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These sync PRs create empty commits on every child repo push to main. The parent meta repo doesn't build or test child repos — it's a workspace coordinator. The empty commits just create noise and trigger release-please unnecessarily. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/on-child-update.yml | 184 -------------------------- 1 file changed, 184 deletions(-) delete mode 100644 .github/workflows/on-child-update.yml diff --git a/.github/workflows/on-child-update.yml b/.github/workflows/on-child-update.yml deleted file mode 100644 index b1453e0..0000000 --- a/.github/workflows/on-child-update.yml +++ /dev/null @@ -1,184 +0,0 @@ -name: On Child Repo Update - -on: - repository_dispatch: - types: [child-repo-updated] - workflow_dispatch: - inputs: - repo_name: - description: 'Child repo name' - required: true - default: 'test-repo' - short_sha: - description: 'Short SHA' - required: true - default: 'abc1234' - message: - description: 'Commit message' - required: true - default: 'feat: test commit' - type: - description: 'Commit type' - required: true - default: 'feat' - actor: - description: 'Actor' - required: true - default: 'test-user' - -concurrency: - group: child-repo-sync - cancel-in-progress: false - -permissions: - contents: write - pull-requests: write - -jobs: - create-sync-commit: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - token: ${{ secrets.PARENT_REPO_PAT }} - - - name: Extract payload - id: payload - env: - EVENT_NAME: ${{ github.event_name }} - DISPATCH_REPO_NAME: ${{ github.event.client_payload.repo_name }} - DISPATCH_SHORT_SHA: ${{ github.event.client_payload.short_sha }} - DISPATCH_MESSAGE: ${{ github.event.client_payload.message }} - DISPATCH_TYPE: ${{ github.event.client_payload.type }} - DISPATCH_ACTOR: ${{ github.event.client_payload.actor }} - INPUT_REPO_NAME: ${{ github.event.inputs.repo_name }} - INPUT_SHORT_SHA: ${{ github.event.inputs.short_sha }} - INPUT_MESSAGE: ${{ github.event.inputs.message }} - INPUT_TYPE: ${{ github.event.inputs.type }} - INPUT_ACTOR: ${{ github.event.inputs.actor }} - run: | - write_output() { - local key="$1" value="$2" - local delim="__EOF__$(date +%s%N)_$RANDOM" - { - printf '%s<<%s\n' "$key" "$delim" - printf '%s\n' "$value" - printf '%s\n' "$delim" - } >> "$GITHUB_OUTPUT" - } - - # Handle both repository_dispatch and workflow_dispatch - if [ "$EVENT_NAME" = "repository_dispatch" ]; then - write_output repo_name "$DISPATCH_REPO_NAME" - write_output short_sha "$DISPATCH_SHORT_SHA" - write_output message "$DISPATCH_MESSAGE" - write_output type "$DISPATCH_TYPE" - write_output actor "$DISPATCH_ACTOR" - else - write_output repo_name "$INPUT_REPO_NAME" - write_output short_sha "$INPUT_SHORT_SHA" - write_output message "$INPUT_MESSAGE" - write_output type "$INPUT_TYPE" - write_output actor "$INPUT_ACTOR" - fi - - - name: Create sync branch and PR - env: - REPO_NAME: ${{ steps.payload.outputs.repo_name }} - SHORT_SHA: ${{ steps.payload.outputs.short_sha }} - MESSAGE: ${{ steps.payload.outputs.message }} - TYPE: ${{ steps.payload.outputs.type }} - ACTOR: ${{ steps.payload.outputs.actor }} - GH_TOKEN: ${{ secrets.PARENT_REPO_PAT }} - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - # Strip the "type: " prefix from the message if present - CLEAN_MSG="${MESSAGE#*: }" - BRANCH="sync/${REPO_NAME}/${SHORT_SHA}" - PR_TITLE="${TYPE}(${REPO_NAME}): ${CLEAN_MSG}" - PR_BODY="Synced from \`${REPO_NAME}@${SHORT_SHA}\` - - Co-authored-by: ${ACTOR} <${ACTOR}@users.noreply.github.com>" - - # Helper: find existing PR for this branch - find_existing_pr() { - gh pr list --head "$BRANCH" --base main --json url --jq '.[0].url // empty' - } - - # Helper: ensure auto-merge is enabled on a PR - enable_auto_merge() { - local pr_url="$1" - echo "Enabling auto-merge on: $pr_url" - gh pr merge "$pr_url" --auto --squash --delete-branch - } - - # Idempotency: if branch already exists, a previous run partially completed. - # Check for an existing PR and just ensure auto-merge is enabled. - if git ls-remote --exit-code origin "refs/heads/$BRANCH" >/dev/null 2>&1; then - echo "Branch $BRANCH already exists — checking for existing PR" - EXISTING_PR=$(find_existing_pr) - if [[ -n "$EXISTING_PR" ]]; then - echo "PR already exists: $EXISTING_PR" - enable_auto_merge "$EXISTING_PR" - exit 0 - fi - # Branch exists but no PR — fetch it and create PR below - git fetch origin "$BRANCH" - git checkout "$BRANCH" - else - git checkout -b "$BRANCH" - git commit --allow-empty -m "$PR_TITLE - - Synced from ${REPO_NAME}@${SHORT_SHA} - - Co-authored-by: ${ACTOR} <${ACTOR}@users.noreply.github.com>" - - # Push may fail if a concurrent run pushed the same branch first - if ! git push -u origin "$BRANCH"; then - echo "Push failed (likely race condition) — recovering" - git fetch origin "$BRANCH" - git checkout "$BRANCH" - # Check if the concurrent run already created a PR - EXISTING_PR=$(find_existing_pr) - if [[ -n "$EXISTING_PR" ]]; then - echo "PR already exists: $EXISTING_PR" - enable_auto_merge "$EXISTING_PR" - exit 0 - fi - # Branch exists remotely but no PR yet — fall through to create PR - fi - fi - - # Create PR (may fail if a concurrent run created it between our check and now) - if ! PR_URL=$(gh pr create \ - --title "$PR_TITLE" \ - --body "$PR_BODY" \ - --head "$BRANCH" \ - --base main); then - echo "PR creation failed — checking for existing PR" - PR_URL=$(find_existing_pr) - if [[ -z "$PR_URL" ]]; then - echo "::error::Failed to create PR and no existing PR found" - exit 1 - fi - fi - - enable_auto_merge "$PR_URL" - echo "PR ready: $PR_URL" - - - name: Log sync - env: - EVENT_NAME: ${{ github.event_name }} - REPO_NAME: ${{ steps.payload.outputs.repo_name }} - SHORT_SHA: ${{ steps.payload.outputs.short_sha }} - TYPE: ${{ steps.payload.outputs.type }} - MESSAGE: ${{ steps.payload.outputs.message }} - run: | - echo "Event: $EVENT_NAME" - echo "Repo: $REPO_NAME" - echo "SHA: $SHORT_SHA" - echo "Type: $TYPE" - echo "Message: $MESSAGE"