diff --git a/.mvn/gradle-enterprise-custom-user-data.groovy b/.mvn/gradle-enterprise-custom-user-data.groovy index 8e78dcf99e597..0f9b416591ea7 100644 --- a/.mvn/gradle-enterprise-custom-user-data.groovy +++ b/.mvn/gradle-enterprise-custom-user-data.groovy @@ -12,6 +12,17 @@ if(session?.getRequest()?.getBaseDirectory() != null) { if(!publish) { // do not publish a build scan for test builds log.debug("Disabling build scan publication for " + session.getRequest().getBaseDirectory()) + + // change storage location on CI to avoid Develocity scan dumps with disabled publication to be captured for republication + if (System.env.GITHUB_ACTIONS) { + try { + def storageLocationTmpDir = java.nio.file.Files.createTempDirectory(java.nio.file.Paths.get(System.env.RUNNER_TEMP), "buildScanTmp").toAbsolutePath() + log.debug('Update storage location to ' + storageLocationTmpDir) + gradleEnterprise.setStorageDirectory(storageLocationTmpDir) + } catch (IOException e) { + log.error('Temporary storage location directory cannot be created, the Build Scan will be published', e) + } + } } } buildScan.publishAlwaysIf(publish)