Update @actions/cache dependency and documentation (#549) · actions/setup-java@78078da (original) (raw)

Original file line number Diff line number Diff line change
@@ -161,6 +161,22 @@ steps:
161 161 run: sbt package
162 162 ```
163 163
164 +#### Cache segment restore timeout
165 +Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a segment download gets stuck, which causes the workflow job to be stuck. The cache segment download timeout [was introduced](https://github.com/actions/toolkit/tree/main/packages/cache#cache-segment-restore-timeout) to solve this issue as it allows the segment download to get aborted and hence allows the job to proceed with a cache miss. The default value of the cache segment download timeout is set to 10 minutes and can be customized by specifying an environment variable named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with a timeout value in minutes.
166 +
167 +```yaml
168 +env:
169 + SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
170 +steps:
171 +- uses: actions/checkout@v3
172 +- uses: actions/setup-java@v3
173 + with:
174 + distribution: 'temurin'
175 + java-version: '17'
176 + cache: 'gradle'
177 +- run: ./gradlew build --no-daemon
178 +```
179 +
164 180 ### Check latest
165 181
166 182 In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download.