Check that job summary support is available

Fixes #319
This commit is contained in:
Daz DeBoer 2022-06-09 09:06:27 -06:00
parent ee54c1fd71
commit f3e4903860
No known key found for this signature in database
GPG Key ID: DD6B9F0B06683D5D
6 changed files with 58 additions and 22 deletions

33
dist/main/index.js vendored
View File

@ -65988,6 +65988,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
@ -65998,15 +66007,17 @@ const fs_1 = __importDefault(__nccwpck_require__(7147));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const cache_reporting_1 = __nccwpck_require__(6674); const cache_reporting_1 = __nccwpck_require__(6674);
function writeJobSummary(buildResults, cacheListener) { function writeJobSummary(buildResults, cacheListener) {
core.info('Writing job summary'); return __awaiter(this, void 0, void 0, function* () {
if (buildResults.length === 0) { core.info('Writing job summary');
core.debug('No Gradle build results found. Summary table will not be generated.'); if (buildResults.length === 0) {
} core.debug('No Gradle build results found. Summary table will not be generated.');
else { }
writeSummaryTable(buildResults); else {
} writeSummaryTable(buildResults);
(0, cache_reporting_1.logCachingReport)(cacheListener); }
core.summary.write(); (0, cache_reporting_1.logCachingReport)(cacheListener);
yield core.summary.write();
});
} }
exports.writeJobSummary = writeJobSummary; exports.writeJobSummary = writeJobSummary;
function loadBuildResults() { function loadBuildResults() {
@ -66392,6 +66403,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.complete = exports.setup = void 0; exports.complete = exports.setup = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const summary_1 = __nccwpck_require__(1327);
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const os = __importStar(__nccwpck_require__(2037)); const os = __importStar(__nccwpck_require__(2037));
@ -66403,6 +66415,9 @@ const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
const CACHE_LISTENER = 'CACHE_LISTENER'; const CACHE_LISTENER = 'CACHE_LISTENER';
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'; const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary';
function shouldGenerateJobSummary() { function shouldGenerateJobSummary() {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER); return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER);
} }
function setup(buildRootDirectory) { function setup(buildRootDirectory) {

File diff suppressed because one or more lines are too long

33
dist/post/index.js vendored
View File

@ -64908,6 +64908,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
@ -64918,15 +64927,17 @@ const fs_1 = __importDefault(__nccwpck_require__(7147));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const cache_reporting_1 = __nccwpck_require__(6674); const cache_reporting_1 = __nccwpck_require__(6674);
function writeJobSummary(buildResults, cacheListener) { function writeJobSummary(buildResults, cacheListener) {
core.info('Writing job summary'); return __awaiter(this, void 0, void 0, function* () {
if (buildResults.length === 0) { core.info('Writing job summary');
core.debug('No Gradle build results found. Summary table will not be generated.'); if (buildResults.length === 0) {
} core.debug('No Gradle build results found. Summary table will not be generated.');
else { }
writeSummaryTable(buildResults); else {
} writeSummaryTable(buildResults);
(0, cache_reporting_1.logCachingReport)(cacheListener); }
core.summary.write(); (0, cache_reporting_1.logCachingReport)(cacheListener);
yield core.summary.write();
});
} }
exports.writeJobSummary = writeJobSummary; exports.writeJobSummary = writeJobSummary;
function loadBuildResults() { function loadBuildResults() {
@ -65076,6 +65087,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.complete = exports.setup = void 0; exports.complete = exports.setup = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const summary_1 = __nccwpck_require__(1327);
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const os = __importStar(__nccwpck_require__(2037)); const os = __importStar(__nccwpck_require__(2037));
@ -65087,6 +65099,9 @@ const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
const CACHE_LISTENER = 'CACHE_LISTENER'; const CACHE_LISTENER = 'CACHE_LISTENER';
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'; const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary';
function shouldGenerateJobSummary() { function shouldGenerateJobSummary() {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER); return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER);
} }
function setup(buildRootDirectory) { function setup(buildRootDirectory) {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@ export interface BuildResult {
get buildScanUri(): string get buildScanUri(): string
} }
export function writeJobSummary(buildResults: BuildResult[], cacheListener: CacheListener): void { export async function writeJobSummary(buildResults: BuildResult[], cacheListener: CacheListener): Promise<void> {
core.info('Writing job summary') core.info('Writing job summary')
if (buildResults.length === 0) { if (buildResults.length === 0) {
@ -24,7 +24,7 @@ export function writeJobSummary(buildResults: BuildResult[], cacheListener: Cach
logCachingReport(cacheListener) logCachingReport(cacheListener)
core.summary.write() await core.summary.write()
} }
export function loadBuildResults(): BuildResult[] { export function loadBuildResults(): BuildResult[] {

View File

@ -1,5 +1,6 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import {SUMMARY_ENV_VAR} from '@actions/core/lib/summary'
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import * as os from 'os' import * as os from 'os'
@ -14,6 +15,11 @@ const CACHE_LISTENER = 'CACHE_LISTENER'
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary' const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'
function shouldGenerateJobSummary(): boolean { function shouldGenerateJobSummary(): boolean {
// Check if Job Summary is supported on this platform
if (!process.env[SUMMARY_ENV_VAR]) {
return false
}
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER) return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER)
} }