Fix up the TOS check and mandatory variable injection

This commit is contained in:
Pavlo Shevchenko 2024-03-20 09:45:41 +01:00 committed by daz
parent 15e0996ffd
commit 5ebc5d3853
No known key found for this signature in database
7 changed files with 22 additions and 20 deletions

View File

@ -83,7 +83,7 @@ jobs:
cache-read-only: false # For testing, allow writing cache entries on non-default branches cache-read-only: false # For testing, allow writing cache entries on non-default branches
gradle-version: ${{ matrix.gradle }} gradle-version: ${{ matrix.gradle }}
build-scan-publish: true build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes" build-scan-terms-of-use-agree: "yes"
- name: Run Gradle build - name: Run Gradle build
id: gradle id: gradle

View File

@ -104,7 +104,7 @@ required, one to enable publishing and two more to accept the [Develocity terms
uses: gradle/actions/dependency-submission@v3 uses: gradle/actions/dependency-submission@v3
with: with:
build-scan-publish: true build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes" build-scan-terms-of-use-agree: "yes"
``` ```

View File

@ -139394,19 +139394,20 @@ exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const input_params_1 = __nccwpck_require__(23885); const input_params_1 = __nccwpck_require__(23885);
function setup() { function setup() {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) { if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true'); maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2'); maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13'); maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('BUILD_SCAN_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)()); maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('BUILD_SCAN_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)()); maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
} }
} }
exports.setup = setup; exports.setup = setup;
function verifyTermsOfUseAgreement() { function verifyTermsOfUseAgreement() {
if ((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' || if (((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' &&
(0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use' || (0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use') ||
(0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') { (0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') {
core.warning(`Terms of use must be agreed in order to publish build scans.`); core.warning(`Terms of use must be agreed in order to publish build scans.`);
return false; return false;
@ -141355,7 +141356,7 @@ function getBuildScanTermsOfUseAgree() {
exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree; exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree;
function getTermsOfUseProp(newPropName, oldPropName) { function getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName); const newProp = core.getInput(newPropName);
if (newProp.length !== 0) { if (newProp !== '') {
return newProp; return newProp;
} }
return core.getInput(oldPropName); return core.getInput(oldPropName);

View File

@ -136847,19 +136847,20 @@ exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const input_params_1 = __nccwpck_require__(23885); const input_params_1 = __nccwpck_require__(23885);
function setup() { function setup() {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) { if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true'); maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2'); maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13'); maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('BUILD_SCAN_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)()); maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('BUILD_SCAN_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)()); maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
} }
} }
exports.setup = setup; exports.setup = setup;
function verifyTermsOfUseAgreement() { function verifyTermsOfUseAgreement() {
if ((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' || if (((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' &&
(0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use' || (0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use') ||
(0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') { (0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') {
core.warning(`Terms of use must be agreed in order to publish build scans.`); core.warning(`Terms of use must be agreed in order to publish build scans.`);
return false; return false;
@ -138674,7 +138675,7 @@ function getBuildScanTermsOfUseAgree() {
exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree; exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree;
function getTermsOfUseProp(newPropName, oldPropName) { function getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName); const newProp = core.getInput(newPropName);
if (newProp.length !== 0) { if (newProp !== '') {
return newProp; return newProp;
} }
return core.getInput(oldPropName); return core.getInput(oldPropName);

View File

@ -702,7 +702,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3 uses: gradle/actions/setup-gradle@v3
with: with:
build-scan-publish: true build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes" build-scan-terms-of-use-agree: "yes"
- name: Run a Gradle build - a build scan will be published automatically - name: Run a Gradle build - a build scan will be published automatically

View File

@ -90,7 +90,7 @@ inputs:
default: false default: false
build-scan-terms-of-use-url: build-scan-terms-of-use-url:
description: The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/help/legal-terms-of-use'. description: 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'.
required: false required: false
build-scan-terms-of-use-agree: build-scan-terms-of-use-agree:

View File

@ -2,21 +2,21 @@ import * as core from '@actions/core'
import {getBuildScanPublishEnabled, getBuildScanTermsOfUseUrl, getBuildScanTermsOfUseAgree} from './input-params' import {getBuildScanPublishEnabled, getBuildScanTermsOfUseUrl, getBuildScanTermsOfUseAgree} from './input-params'
export function setup(): void { export function setup(): 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 (getBuildScanPublishEnabled() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle')
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true') maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2') maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2')
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13') maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13')
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', getBuildScanTermsOfUseUrl()) maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', getBuildScanTermsOfUseUrl())
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', getBuildScanTermsOfUseAgree()) maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', getBuildScanTermsOfUseAgree())
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions')
} }
} }
function verifyTermsOfUseAgreement(): boolean { function verifyTermsOfUseAgreement(): boolean {
if ( if (
getBuildScanTermsOfUseUrl() !== 'https://gradle.com/terms-of-service' || (getBuildScanTermsOfUseUrl() !== 'https://gradle.com/terms-of-service' &&
getBuildScanTermsOfUseUrl() !== 'https://gradle.com/help/legal-terms-of-use' || getBuildScanTermsOfUseUrl() !== 'https://gradle.com/help/legal-terms-of-use') ||
getBuildScanTermsOfUseAgree() !== 'yes' getBuildScanTermsOfUseAgree() !== 'yes'
) { ) {
core.warning(`Terms of use must be agreed in order to publish build scans.`) core.warning(`Terms of use must be agreed in order to publish build scans.`)