Skip to content

Add pre-merge cherry-pick flow for patch-labeled PRs#579

Merged
kriszyp merged 3 commits into
mainfrom
cherry-pick-pre-merge-flow
May 19, 2026
Merged

Add pre-merge cherry-pick flow for patch-labeled PRs#579
kriszyp merged 3 commits into
mainfrom
cherry-pick-pre-merge-flow

Conversation

@kriszyp
Copy link
Copy Markdown
Member

@kriszyp kriszyp commented May 18, 2026

Summary

Mirror of HarperFast/harper-pro#151 (plus the checkout-ref fix from harper-pro#157), ported to core.

When a PR is labeled patch:

  • Create/reset cherry-pick/<release>/pr-<N> off the release branch, cherry-pick the PR commits.
  • On success, dispatch both Integration Tests and Unit Test workflows against that branch. Sticky comments on the original PR link the runs and (via report-cherry-pick-tests.yml) update with pass/fail when each completes.
  • On conflict, commit the markers, push, and @-mention Claude to suggest a resolution patch (no auto-push).
  • On unlabeled, tear down the branch.
  • On closed && merged, re-pick from the final merge SHA and fast-forward into the release branch.

Differences from harper-pro

  • Dispatches both integration-tests.yml and unit-test.yml (core has both; harper-pro only has integration tests).
  • report-cherry-pick-tests.yml listens for completion of both workflows and uses a per-workflow sticky marker so the two results don't overwrite each other.

Where to focus review

  • .github/workflows/cherry-pick-patch.yml — the main logic.
  • report-cherry-pick-tests.yml — gated on head_repository.full_name == github.repository to block fork spoofing.

🤖 Generated by Claude Opus 4.7 (1M context).

Mirror of HarperFast/harper-pro PR #151 (plus the checkout-ref fix from
#157), adapted for core:

- .github/workflows/cherry-pick-patch.yml: rewritten to a pre-merge
  flow. On `labeled`/`synchronize` (re)create
  cherry-pick/<release>/pr-<N> off the release branch, cherry-pick the
  PR commits, dispatch unit + integration tests on success, commit
  conflict markers and @-mention Claude on failure. On merge,
  fast-forward into the release branch. On unlabel, tear down.
  Pinned to ref: main so the helper script is always present.
- .github/workflows/report-cherry-pick-tests.yml: workflow_run listener
  for both Integration Tests and Unit Test. Uses per-workflow sticky
  marker so the two results don't overwrite each other. Gated on
  head_repository == repository to block fork spoofing.
- .github/scripts/upsert-sticky-comment.js: shared sticky-comment
  upsert helper keyed by marker string.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kriszyp kriszyp requested review from a team as code owners May 18, 2026 20:01
For pull_request events, GitHub loads the workflow definition from the
PR head ref, so PRs branched off main before this workflow landed
won't trigger the new label flow. Switch to pull_request_target so the
definition is always loaded from main. Token has write scope; we
mitigate the usual risk by pinning checkout to main and only running
git against PR commits — no PR-controlled scripts are executed in this
workflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/cherry-pick-patch.yml
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 18, 2026

Reviewed; no blockers found. The prior finding (workflow files on the cherry-pick branch executing under write permissions) is resolved — pull_request_target ensures the workflow definition always loads from main, and the new pre-dispatch diff check (lines 203–208) blocks test triggering if the cherry-pick branch modifies any .github/workflows/ file.

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@kriszyp
Copy link
Copy Markdown
Member Author

kriszyp commented May 19, 2026

Just copying from harper-pro

@kriszyp kriszyp merged commit 7ace3cf into main May 19, 2026
34 of 36 checks passed
@kriszyp kriszyp deleted the cherry-pick-pre-merge-flow branch May 19, 2026 04:24
kriszyp pushed a commit that referenced this pull request May 19, 2026
Resolves conflicts caused by the .js → .ts rename pass on main (most of
the codebase moved from CommonJS to ESM TS in #460/#579). Specifically:

- bin/cliOperations.ts: kept main's ESM imports + new CLI features
  (loadCredentials, isJWTExpired, normalizeTarget) and layered in the
  multipart streaming additions (streamPackagedDirectory, buildMultipartBody,
  TRANSPORT_ONLY_FIELDS, the _multipart branch, body=stream).
- components/Application.ts: kept the Buffer | string | Readable payload
  switch from this branch (main's resolution was just a Buffer/base64
  fallback).
- server/serverHelpers/multipartParser.ts: updated the hdbError import
  from .js to .ts to match the rename.

Co-Authored-By: Claude Opus 4.7 (1M context) <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