Skip to content

Commit fb5165d

Browse files
authored
Add note about cache-encryption-key being required
1 parent 0e27ea7 commit fb5165d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/setup-gradle.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ When Gradle is executed with the [configuration-cache](https://docs.gradle.org/c
196196
in the project directory, at `<project-dir>/.gradle/configuration-cache`. Due to the way the configuration-cache works, [this file may contain stored credentials and other
197197
secrets](https://docs.gradle.org/release-nightly/userguide/configuration_cache.html#config_cache:secrets), and this data needs to be encrypted to be safely stored in the GitHub Actions cache.
198198

199+
> [!IMPORTANT]
200+
> To avoid potentially leaking secrets in the configuration-cache entry, the action will only save or restore configuration-cache data if the `cache-encryption-key` parameter is set.
201+
199202
To benefit from configuration caching in your GitHub Actions workflow, you must:
200203
- Execute your build with Gradle 8.6 or newer. This can be achieved directly or via the Gradle Wrapper.
201204
- Enable the configuration cache for your build.
@@ -220,7 +223,10 @@ jobs:
220223
- run: gradle build --configuration-cache
221224
```
222225

223-
> [!IMPORTANT]
226+
Even with everything correctly configured, you may find that the configuration-cache entry is not reused in your workflow.
227+
This is often due to a known issue: [Included builds containing build logic prevent configuration-cache reuse](https://github.com/gradle/actions/issues/21). Refer to the issue for more details.
228+
229+
> [!NOTE]
224230
> The configuration cache cannot be saved or restored in workflows triggered by a pull requests from a repository fork.
225231
> This is because [GitHub secrets are not passed to workflows triggered by PRs from forks](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow).
226232
> This prevents a malicious PR from reading the configuration-cache data, which may encode secrets read by Gradle.

0 commit comments

Comments
 (0)