# Gradle dependency retention

The mobile release workflow retains completed dependency downloads even when its build or a
later store operation fails. Both cache operations remain optional and bounded to two minutes;
a cache result cannot turn a failed build or upload green. Cancelled jobs and workflows reusing
a confirmed upload do not save Gradle caches.

Successful jobs preserve the original setup-java complete key, dependency inputs and absolute
cache paths. Failed jobs save a distinct `-partial-<run_id>-<attempt>` suffix instead, so a
partial download cannot occupy the immutable completed key or prevent a later full save.
Restoration first uses the complete key, then the existing same-OS/architecture key prefix.
Required Gradle work resolves any still-missing dependencies through the assigned account exit.
The pinned cache preloader remains confined to the official cache processes.

GitHub caches are branch-scoped: task branches cannot restore sibling branches' caches, while
default-branch caches can serve subsequent task branches. The normal default-branch release
therefore retains useful downloads after failure as well as after successful delivery. It
adds no warming workflow, extra main validation, upload retry or release dispatch.

On adoption, preserve app-specific dependency inputs, platforms and existing restore identities.
Candidate and release workflows need compatible keys, paths and compression versions to share
default-branch caches. An app's custom prefix needs an explicit compatible fallback; changing a
package pin alone does not update custom workflow bytes. Keep the current task branch and its
cache while repairing a failed candidate; do not rotate branches merely to retry it.

Verify the actual cache's branch, key, size and restore/save result. A successful cache action
does not itself prove a hit or a complete dependency graph. Never transfer task-branch caches
into a trusted default-branch scope by bypassing GitHub's restrictions.

See [GitHub's cache restrictions and key matching][cache-rules].

[cache-rules]: https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching
