Skip to content

chore(ci): make foss/private sync atomic and faster#60583

Merged
Piccirello merged 2 commits into
masterfrom
tom/sync-workflows-rework
May 29, 2026
Merged

chore(ci): make foss/private sync atomic and faster#60583
Piccirello merged 2 commits into
masterfrom
tom/sync-workflows-rework

Conversation

@Piccirello
Copy link
Copy Markdown
Member

@Piccirello Piccirello commented May 29, 2026

The current PostHog/git-sync action has two issues:

  • It's slow as hell, usually taking between 6 and 12 minutes, because it copies the entire 4GiB+ history every time
  • It's not atomic. The ee/ directory and our proprietary license are copied over first and then the removal/license change happens at some later point. The workflow could fail between the two steps, leaving posthog-foss with a non-MIT license.

This PR replaces PostHog/git-sync with a blob:none partial-clone checkout plus a direct push. The full commit graph keeps pushes connected while historical blobs are fetched lazily, so runs no longer re-download the whole repo.

foss-sync also now builds the signed FOSS commit on a staging branch via the GitHub API and then atomically repoints master, so posthog-foss/master is never momentarily left as raw posthog (with ee/ present).

Replace PostHog/git-sync (which full-clones the entire history into a fresh
container every run) with a blob:none partial-clone checkout plus a direct
push. The full commit graph keeps pushes connected while historical blobs are
fetched lazily, so runs no longer re-download the whole repo.

foss-sync now builds the signed FOSS commit on a staging branch via the GitHub
API and then atomically repoints master, so posthog-foss/master is never
momentarily left as raw posthog (ee/ present, non-MIT LICENSE) between the
sync and the cleanup commit. private-sync stays a 1:1 mirror, just via a
direct push of master and tags.
@Piccirello Piccirello requested a review from a team May 29, 2026 00:23
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/workflows/foss-sync.yml:43-49
**Staging branch persists with non-FOSS content on workflow failure**

`foss-sync-staging` is pushed to the public `posthog/posthog-foss` repo at the raw posthog HEAD (including `ee/` and the non-MIT LICENSE) before any FOSS transformations are applied. If the workflow fails anywhere between this push and the final "Promote staging to master and clean up" step, that branch is left behind indefinitely with non-FOSS code visible to anyone. The only cleanup currently runs as the last command in a script that exits early on any error.

Adding a cleanup step with `if: always()` would delete `foss-sync-staging` regardless of whether the run succeeds or fails.

Reviews (1): Last reviewed commit: "chore(ci): make foss/private sync gap-fr..." | Re-trigger Greptile

Comment thread .github/workflows/foss-sync.yml
@Piccirello Piccirello merged commit ca696d6 into master May 29, 2026
150 of 151 checks passed
@Piccirello Piccirello deleted the tom/sync-workflows-rework branch May 29, 2026 20:14
@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented May 29, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-05-29 20:45 UTC Run
prod-us ✅ Deployed 2026-05-29 21:05 UTC Run
prod-eu ✅ Deployed 2026-05-29 21:06 UTC Run

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.

2 participants