|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved. |
| 3 | +// |
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +// you may not use this file except in compliance with the License. |
| 6 | +// You may obtain a copy of the License at |
| 7 | +// |
| 8 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +// |
| 10 | +// Unless required by applicable law or agreed to in writing, software |
| 11 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +// See the License for the specific language governing permissions and |
| 14 | +// limitations under the License. |
| 15 | +//===----------------------------------------------------------------------===// |
| 16 | +/// Configures Gradle for GitHub actions, caching state and generating a dependency graph via Dependency Submission. |
| 17 | +module pkl.impl.ghactions.actions.gradle.actions.`setup-gradle`.v5.SetupGradle |
| 18 | + |
| 19 | +extends "@com.github.actions/AbstractTypedStep.pkl" |
| 20 | + |
| 21 | +fixed action: "gradle/actions/setup-gradle" |
| 22 | + |
| 23 | +fixed version: "v5" |
| 24 | + |
| 25 | +with: With |
| 26 | + |
| 27 | +class With { |
| 28 | + /// Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle. |
| 29 | + /// If not provided, it is assumed that the project uses the Gradle Wrapper. |
| 30 | + `gradle-version`: String? |
| 31 | + |
| 32 | + /// When 'true', all caching is disabled. No entries will be written to or read from the cache. |
| 33 | + /// |
| 34 | + /// Default if unspecified: `false` |
| 35 | + `cache-disabled`: Boolean? |
| 36 | + |
| 37 | + /// When 'true', existing entries will be read from the cache but no entries will be written. |
| 38 | + /// By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches. |
| 39 | + /// |
| 40 | + /// Default if unspecified: `"${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}"` |
| 41 | + `cache-read-only`: Boolean? |
| 42 | + |
| 43 | + /// When 'true', entries will not be restored from the cache but will be saved at the end of the Job. |
| 44 | + /// Setting this to 'true' implies cache-read-only will be 'false'. |
| 45 | + /// |
| 46 | + /// Default if unspecified: `false` |
| 47 | + `cache-write-only`: Boolean? |
| 48 | + |
| 49 | + /// When 'true', a pre-existing Gradle User Home will not prevent the cache from being restored. |
| 50 | + /// |
| 51 | + /// Default if unspecified: `false` |
| 52 | + `cache-overwrite-existing`: Boolean? |
| 53 | + |
| 54 | + /// A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps. |
| 55 | + /// A suitable key can be generated with `openssl rand -base64 16`. |
| 56 | + /// Configuration-cache data will not be saved/restored without an encryption key being provided. |
| 57 | + `cache-encryption-key`: String? |
| 58 | + |
| 59 | + /// Specifies if the action should attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache. |
| 60 | + /// By default ('on-success'), cleanup is performed when all Gradle builds succeed for the Job. |
| 61 | + /// This behaviour can be disabled ('never'), or configured to always run irrespective of the build outcome ('always'). |
| 62 | + /// Valid values are 'never', 'on-success' and 'always'. |
| 63 | + /// |
| 64 | + /// Default if unspecified: `"on-success"` |
| 65 | + `cache-cleanup`: ("never" | "on-success" | "always")? |
| 66 | + |
| 67 | + /// When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache. |
| 68 | + `gradle-home-cache-cleanup`: Boolean? |
| 69 | + |
| 70 | + /// Paths within Gradle User Home to cache. |
| 71 | + /// |
| 72 | + /// Default if unspecified: `""" |
| 73 | + /// caches |
| 74 | + /// notifications |
| 75 | + /// |
| 76 | + /// """` |
| 77 | + hidden `gradle-home-cache-includes-list`: Listing<String>? |
| 78 | + |
| 79 | + /// Paths within Gradle User Home to cache. |
| 80 | + /// |
| 81 | + /// Default if unspecified: `""" |
| 82 | + /// caches |
| 83 | + /// notifications |
| 84 | + /// |
| 85 | + /// """` |
| 86 | + /// |
| 87 | + /// To set as a [Listing], use [`gradle-home-cache-includes-list`]. |
| 88 | + `gradle-home-cache-includes`: String? = `gradle-home-cache-includes-list`?.join("\n") |
| 89 | + |
| 90 | + /// Paths within Gradle User Home to exclude from cache. |
| 91 | + hidden `gradle-home-cache-excludes-list`: Listing<String>? |
| 92 | + |
| 93 | + /// Paths within Gradle User Home to exclude from cache. |
| 94 | + /// |
| 95 | + /// To set as a [Listing], use [`gradle-home-cache-excludes-list`]. |
| 96 | + `gradle-home-cache-excludes`: String? = `gradle-home-cache-excludes-list`?.join("\n") |
| 97 | + |
| 98 | + /// Specifies when a Job Summary should be inluded in the action results. Valid values are 'never', 'always' (default), and 'on-failure'. |
| 99 | + /// |
| 100 | + /// Default if unspecified: `"always"` |
| 101 | + `add-job-summary`: ("never" | "always" | "on-failure")? |
| 102 | + |
| 103 | + /// Specifies when each Job Summary should be added as a PR comment. Valid values are 'never' (default), 'always', and 'on-failure'. No action will be taken if the workflow was not triggered from a pull request. |
| 104 | + /// |
| 105 | + /// Default if unspecified: `"never"` |
| 106 | + `add-job-summary-as-pr-comment`: ("never" | "always" | "on-failure")? |
| 107 | + |
| 108 | + /// Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how. |
| 109 | + /// Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-submit-and-upload', 'generate-and-upload', and 'download-and-submit'. |
| 110 | + /// |
| 111 | + /// Default if unspecified: `"disabled"` |
| 112 | + `dependency-graph`: ( |
| 113 | + "disabled" |
| 114 | + | "generate" |
| 115 | + | "generate-and-submit" |
| 116 | + | "generate-submit-and-upload" |
| 117 | + | "generate-and-upload" |
| 118 | + | "download-and-submit" |
| 119 | + )? |
| 120 | + |
| 121 | + /// Specifies where the dependency graph report will be generated. |
| 122 | + /// Paths can relative or absolute. Relative paths are resolved relative to the workspace directory. |
| 123 | + /// |
| 124 | + /// Default if unspecified: `"dependency-graph-reports"` |
| 125 | + `dependency-graph-report-dir`: String? |
| 126 | + |
| 127 | + /// When 'false' a failure to generate or submit a dependency graph will fail the Step or Job. When 'true' a warning will be emitted but no failure will result. |
| 128 | + /// |
| 129 | + /// Default if unspecified: `true` |
| 130 | + `dependency-graph-continue-on-failure`: Boolean? |
| 131 | + |
| 132 | + /// Gradle projects that should be excluded from dependency graph (regular expression). |
| 133 | + /// When set, any matching project will be excluded. |
| 134 | + `dependency-graph-exclude-projects`: String? |
| 135 | + |
| 136 | + /// Gradle projects that should be included in dependency graph (regular expression). |
| 137 | + /// When set, only matching projects will be included. |
| 138 | + `dependency-graph-include-projects`: String? |
| 139 | + |
| 140 | + /// Gradle configurations that should be included in dependency graph (regular expression). |
| 141 | + /// When set, anymatching configurations will be excluded. |
| 142 | + `dependency-graph-exclude-configurations`: String? |
| 143 | + |
| 144 | + /// Gradle configurations that should be included in dependency graph (regular expression). |
| 145 | + /// When set, only matching configurations will be included. |
| 146 | + `dependency-graph-include-configurations`: String? |
| 147 | + |
| 148 | + /// Specifies the number of days to retain any artifacts generated by the action. If not set, the default retention settings for the repository will apply. |
| 149 | + `artifact-retention-days`: Int? |
| 150 | + |
| 151 | + /// Set to 'true' to automatically publish build results as a Build Scan on scans.gradle.com. |
| 152 | + /// For publication to succeed without user input, you must also provide values for `build-scan-terms-of-use-url` and 'build-scan-terms-of-use-agree'. |
| 153 | + /// |
| 154 | + /// Default if unspecified: `false` |
| 155 | + `build-scan-publish`: Boolean? |
| 156 | + |
| 157 | + /// The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/terms-of-service' or 'https://gradle.com/help/legal-terms-of-use'. |
| 158 | + `build-scan-terms-of-use-url`: String? |
| 159 | + |
| 160 | + /// Indicate that you agree to the Build Scan® terms of use. This input value must be "yes". |
| 161 | + `build-scan-terms-of-use-agree`: ("yes")? |
| 162 | + |
| 163 | + /// Develocity access key. Should be set to a secret containing the Develocity Access key. |
| 164 | + `develocity-access-key`: String? |
| 165 | + |
| 166 | + /// The Develocity short-lived access tokens expiry in hours. Default is 2 hours. |
| 167 | + `develocity-token-expiry`: Int? |
| 168 | + |
| 169 | + /// Enables Develocity injection. |
| 170 | + `develocity-injection-enabled`: Boolean? |
| 171 | + |
| 172 | + /// The URL for the Develocity server. |
| 173 | + `develocity-url`: String? |
| 174 | + |
| 175 | + /// Allow communication with an untrusted server; set to _true_ if your Develocity instance is using a self-signed. |
| 176 | + `develocity-allow-untrusted-server`: Boolean? |
| 177 | + |
| 178 | + /// Enables capturing the paths and content hashes of each individual input file. |
| 179 | + `develocity-capture-file-fingerprints`: Boolean? |
| 180 | + |
| 181 | + /// Enforce the configured Develocity URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Develocity URL. |
| 182 | + `develocity-enforce-url`: Boolean? |
| 183 | + |
| 184 | + /// The version of the Develocity Gradle plugin to apply. |
| 185 | + `develocity-plugin-version`: String? |
| 186 | + |
| 187 | + /// The version of the Common Custom User Data Gradle plugin to apply, if any. |
| 188 | + `develocity-ccud-plugin-version`: String? |
| 189 | + |
| 190 | + /// The URL of the repository to use when resolving the Develocity and CCUD plugins; the Gradle Plugin Portal is used by default. |
| 191 | + `gradle-plugin-repository-url`: String? |
| 192 | + |
| 193 | + /// The username for the repository URL to use when resolving the Develocity and CCUD. |
| 194 | + `gradle-plugin-repository-username`: String? |
| 195 | + |
| 196 | + /// The password for the repository URL to use when resolving the Develocity and CCUD plugins; Consider using secrets to pass the value to this variable. |
| 197 | + `gradle-plugin-repository-password`: String? |
| 198 | + |
| 199 | + /// When 'true' (the default) the action will automatically validate all wrapper jars found in the repository. |
| 200 | + /// If the wrapper checksums are not valid, the action will fail. |
| 201 | + /// |
| 202 | + /// Default if unspecified: `true` |
| 203 | + `validate-wrappers`: Boolean? |
| 204 | + |
| 205 | + /// When 'true', wrapper validation will include the checksums of snapshot wrapper jars. |
| 206 | + /// Use this if you are running with nightly or snapshot versions of the Gradle wrapper. |
| 207 | + /// |
| 208 | + /// Default if unspecified: `false` |
| 209 | + `allow-snapshot-wrappers`: Boolean? |
| 210 | + |
| 211 | + /// Gradle command line arguments (supports multi-line input) |
| 212 | + arguments: String? |
| 213 | + |
| 214 | + /// When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs. |
| 215 | + /// |
| 216 | + /// Default if unspecified: `false` |
| 217 | + `gradle-home-cache-strict-match`: Boolean? |
| 218 | + |
| 219 | + /// Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL). |
| 220 | + /// |
| 221 | + /// Default if unspecified: `"${{ toJSON(matrix) }}"` |
| 222 | + `workflow-job-context`: String? |
| 223 | + |
| 224 | + /// The GitHub token used to authenticate when submitting via the Dependency Submission API. |
| 225 | + /// |
| 226 | + /// Default if unspecified: `"${{ github.token }}"` |
| 227 | + `github-token`: String? |
| 228 | +} |
0 commit comments