mirror of
https://github.com/gradle/actions.git
synced 2025-12-08 17:15:46 +08:00
Replace static config methods with config types
This will allow different entry points to have different inputs.
This commit is contained in:
@@ -1,30 +1,18 @@
|
||||
import * as core from '@actions/core'
|
||||
import {getBuildScanPublishEnabled, getBuildScanTermsOfUseUrl, getBuildScanTermsOfUseAgree} from './input-params'
|
||||
import {BuildScanConfig} from './input-params'
|
||||
|
||||
export function setup(): void {
|
||||
export function setup(config: BuildScanConfig): void {
|
||||
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle')
|
||||
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions')
|
||||
if (getBuildScanPublishEnabled() && verifyTermsOfUseAgreement()) {
|
||||
if (config.getBuildScanPublishEnabled()) {
|
||||
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
|
||||
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17')
|
||||
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13')
|
||||
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', getBuildScanTermsOfUseUrl())
|
||||
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', getBuildScanTermsOfUseAgree())
|
||||
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl())
|
||||
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree())
|
||||
}
|
||||
}
|
||||
|
||||
function verifyTermsOfUseAgreement(): boolean {
|
||||
if (
|
||||
(getBuildScanTermsOfUseUrl() !== 'https://gradle.com/terms-of-service' &&
|
||||
getBuildScanTermsOfUseUrl() !== 'https://gradle.com/help/legal-terms-of-use') ||
|
||||
getBuildScanTermsOfUseAgree() !== 'yes'
|
||||
) {
|
||||
core.warning(`Terms of use must be agreed in order to publish build scans.`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function maybeExportVariable(variableName: string, value: unknown): void {
|
||||
if (!process.env[variableName]) {
|
||||
core.exportVariable(variableName, value)
|
||||
|
||||
Reference in New Issue
Block a user