Files
actions/sources/src/actions/setup-gradle/main.ts
T
Daz DeBoerandGitHub f64284c333 Mute license warning when terms are accepted (#911)
With licensing changes in v6, a license warning was added to the logs
and job summary. Now, accepting the Build Scan Terms of Use or providing
a Develocity Access Key will mute this warning.
2026-03-24 08:46:15 -06:00

50 lines
1.6 KiB
TypeScript

import * as setupGradle from '../../setup-gradle'
import * as provisioner from '../../execution/provision'
import * as dependencyGraph from '../../dependency-graph'
import {
DevelocityConfig,
CacheConfig,
DependencyGraphConfig,
GradleExecutionConfig,
WrapperValidationConfig,
getActionId,
setActionId
} from '../../configuration'
import {failOnUseOfRemovedFeature, saveDeprecationState} from '../../deprecation-collector'
import {handleMainActionError} from '../../errors'
import {forceExit} from '../../force-exit'
/**
* The main entry point for the action, called by Github Actions for the step.
*/
export async function run(): Promise<void> {
try {
if (getActionId() === 'gradle/gradle-build-action') {
failOnUseOfRemovedFeature(
'The action `gradle/gradle-build-action` has been replaced by `gradle/actions/setup-gradle`'
)
}
setActionId('gradle/actions/setup-gradle')
// Configure Gradle environment (Gradle User Home)
await setupGradle.setup(new CacheConfig(), new DevelocityConfig(), new WrapperValidationConfig())
// Configure the dependency graph submission
await dependencyGraph.setup(new DependencyGraphConfig())
const config = new GradleExecutionConfig()
config.verifyNoArguments()
await provisioner.provisionGradle(config.getGradleVersion())
saveDeprecationState()
} catch (error) {
handleMainActionError(error)
}
// Explicit process.exit() to prevent waiting for hanging promises.
await forceExit()
}
run()