Skip to content

ci: Rebase the fork onto upstream kDrive and build it automatically - #1

Merged
fabiocatalao merged 2 commits into
mainfrom
ccr-9700e055-itslra
Oct 2, 2026
Merged

fabiocatalao merged 2 commits into
mainfrom
ccr-9700e055-itslra

Conversation

@fabiocatalao

@fabiocatalao fabiocatalao commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Adds a Fork sync workflow that keeps this fork's commits on top of Infomaniak's latest kDrive release and builds an APK.

What it does

On main (daily at 05:17 UTC, on every push, or on demand from the Actions tab):

  1. .github/fork-sync/sync.sh rebases the fork's own commits onto the latest upstream release tag (currently 5.22.1). It uses git rebase --onto <tag> <merge-base>, so only the fork's commits are replayed, and merge commits (PR merges, "Sync fork" merges) are dropped.
  2. Builds the standard release APK and signs it with the fork's key.
  3. Only if the build passes: force-pushes the rebased main (with --force-with-lease) and publishes a GitHub release with the APK and the list of fork commits.

If a commit doesn't rebase cleanly, or the rebased code doesn't build, main is left untouched and an issue labelled fork-sync is opened and assigned to the repo owner, with the exact commands to fix it locally. The next run that builds main successfully closes it. A failure that is already reported doesn't add a comment each day.

On pull requests to main, the workflow only builds and attaches the APK to the run as an artifact.

Files

  • .github/workflows/fork-sync.yml: the workflow.
  • .github/fork-sync/sync.sh: the rebase. CI runs it with ABORT_ON_CONFLICT=1. Run locally, it stops at a conflict so you can resolve it.
  • .github/fork-sync/report.sh: opens, updates and closes the issue.
  • .github/fork-sync/skip-sentry-upload.init.gradle: Gradle init script that skips the release build's uploads to Infomaniak's Sentry, which this fork has no credentials for. The build files themselves aren't touched.
  • .github/fork-sync/README.md: setup instructions.

Everything lives in new files, so none of this can conflict with upstream.

main was rebased onto 5.22.1 first

main has already been rebased onto upstream 5.22.1, so the first sync after merging has nothing to rebase and goes straight to building and releasing. This PR now sits on top of that main.

The quick-delete commit conflicted in FileInfoActionsView.kt, because upstream changed the delete-visibility rule (shared files you created can now be deleted). The resolution keeps upstream's rule and uses it for both the menu action and the quick-delete button:

val canDelete =
    rights.canDelete == true && !file.isImporting() && (!isSharedWithMe || currentFile.createdByCurrentUser())
deleteFile.isVisible = canDelete
fileView.quickDeleteButton.isVisible = canDelete

The old main was d9b311b.

Setup needed before merging

See .github/fork-sync/README.md. In short:

  • Enable Actions on the fork, and disable Infomaniak's six internal workflows.
  • Add a SYNC_TOKEN secret: a fine-grained token with Contents and Workflows read/write. The built-in token can't push the rebased main, because upstream changes workflow files.
  • Add the SIGNING_* secrets for signed releases.

Testing

  • sync.sh, run against the real upstream in a scratch clone:
    • Rebasing the two drag-to-select commits onto 5.22.1 is clean.
    • A second run is a no-op, and an older explicit tag is a no-op.
    • Tracking main works, as do history with a PR merge commit and history with an upstream merge.
    • It refuses a dirty tree, a detached HEAD, a bad setting, or a rebase already in progress.
  • The conflict path (on the old main): it reported the quick-delete commit and the conflicting file, and left the branch unchanged in CI mode. Run locally, it stopped at the conflict for resolution; that's how main was rebased.
  • The workflow's decision step was run locally for every trigger: PR, rebased with and without the token, scheduled no-op, push by a user, push by the workflow itself, already released, forced release, and a bad flavor.
  • report.sh was run against a stubbed gh: new issue, duplicate suppressed, retitled with a comment, and closed on success.
  • The Gradle init script was checked on a dummy project: the Sentry upload and bundle tasks are skipped and the other tasks run.
  • Linting: actionlint passes with shellcheck integration, and shellcheck reports no warnings on the scripts.
  • End-to-end on GitHub Actions: this PR's Build job on the old base (d5eb517) passed. It produced a release APK in about 11 minutes, with the Sentry upload and bundle tasks shown as SKIPPED and an unsigned APK artifact, since no signing secrets are set. The run on the current head compiles the rebased 5.22.1 code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQpS1fDBQzXvMNRrdX4qgM

Copy link
Copy Markdown
Owner Author

validate-strings (Validate translations) is red, but not because of this PR. It's one of Infomaniak's internal workflows. It checks the app's existing translations against the rules of their translation platform (Loco), and finds 20 inconsistencies that are already there. For example, trashedFileRestoreFileInSuccess uses %1$d in de/en/fr but %1$s in es/it. This PR only touches .github/, so main fails the same way, and a re-run would too.

Nothing in this PR can fix it. The translations are upstream's, so patching them here would only add conflicts on every sync. The fix is setup step 2 in .github/fork-sync/README.md: disable Infomaniak's six workflows in this fork's Actions tab.

PR and Commit Message Check failed because my commit message didn't follow Infomaniak's conventional-commit format. That's fixed in d5eb517 (reworded only; the content is unchanged).


Generated by Claude Code

The Fork sync workflow runs daily, on pushes to main and on demand. It
rebases the fork's own commits onto the latest upstream kDrive release,
builds a signed release APK, and only then force-pushes main and
publishes a GitHub release. A rebase conflict or failed build leaves main
untouched and opens an issue with the commands to fix it locally. Pull
requests to main are built without being pushed or released.

.github/fork-sync/sync.sh does the rebase and can be run locally too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQpS1fDBQzXvMNRrdX4qgM
A PR build failed in :app:packageStandardRelease with only Gradle's
generic "A failure occurred while executing IncrementalSplitterRunnable",
while the identical code built fine one run earlier. Run Gradle with
--stacktrace so the underlying exception is printed, and report disk,
memory and recent kernel messages after a failed build, so the next
occurrence shows whether the runner ran out of space or memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQpS1fDBQzXvMNRrdX4qgM
@fabiocatalao
fabiocatalao marked this pull request as ready for review October 2, 2026 06:43
@fabiocatalao
fabiocatalao merged commit 2962dd4 into main Oct 2, 2026
2 checks passed
@fabiocatalao
fabiocatalao deleted the ccr-9700e055-itslra branch October 2, 2026 06:43
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