Skip to content

Commit

Permalink
Build action
Browse files Browse the repository at this point in the history
  • Loading branch information
zegl committed Sep 8, 2022
1 parent 79f37eb commit 1d99c45
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions dist/status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17977,6 +17977,17 @@ const getJobType = (job) => {
}
return 'unknown';
};
const getConfidence = (job) => {
var _a, _b;
if ((0, lib_1.isContributionJob)(job)) {
const probabilities = (_b = (_a = job.contribution) === null || _a === void 0 ? void 0 : _a.predicted_outcome) === null || _b === void 0 ? void 0 : _b.file_probabilities;
if (probabilities) {
return Math.min(...probabilities);
}
return 0;
}
return 0;
};
const run = (jobID) => __awaiter(void 0, void 0, void 0, function* () {
core.info(`Job ID: ${jobID}`);
let job = yield (0, lib_1.get)(jobID);
Expand All @@ -17991,16 +18002,19 @@ const run = (jobID) => __awaiter(void 0, void 0, void 0, function* () {
return {
isApproved: isApproved(job),
isSuggested: isSuggested(job),
jobType: getJobType(job)
jobType: getJobType(job),
confidence: getConfidence(job)
};
});
const jobID = (0, lib_1.required)('codeball-job-id');
run(jobID)
.then(({ isApproved, isSuggested, jobType }) => __awaiter(void 0, void 0, void 0, function* () {
.then(({ isApproved, isSuggested, jobType, confidence }) => __awaiter(void 0, void 0, void 0, function* () {
yield (0, track_1.track)({ jobID, actionName: 'status' });
core.setOutput('approved', isApproved);
core.setOutput('suggested', isSuggested);
core.setOutput('jobType', jobType);
core.setOutput('confidence', confidence.toFixed(3));
core.info(`Confidence: ${confidence.toFixed(3)}`);
}))
.catch((error) => __awaiter(void 0, void 0, void 0, function* () {
if (error instanceof Error) {
Expand Down
2 changes: 1 addition & 1 deletion dist/status/index.js.map

Large diffs are not rendered by default.

0 comments on commit 1d99c45

Please sign in to comment.