Skip to content

Commit

Permalink
SCP-52 Adds reports table
Browse files Browse the repository at this point in the history
  • Loading branch information
francostramana committed Jan 23, 2024
1 parent 2372858 commit 5866fb9
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 210 deletions.
3 changes: 2 additions & 1 deletion .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ rules:
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
'@typescript-eslint/unbound-method': 'error',
'github/array-foreach' : 'off'
}
249 changes: 151 additions & 98 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as exec from '@actions/exec';
import { getLicenses, readResult } from './services/result.service';
import { createCommentOnPR, isPullRequest } from './utils/github.utils';
import { LicensePolicyCheck } from './policies/license-policy-check';
import { getLicensesReport } from './services/report.service';

/**
* The main function for the action.
Expand All @@ -15,7 +16,7 @@ export async function run(): Promise<void> {

// create policies
const policies = [new LicensePolicyCheck()];
policies.forEach(policy => policy.start());
policies.forEach(async policy => policy.start());

// options to get standar output
const options: exec.ExecOptions = {};
Expand All @@ -40,14 +41,14 @@ export async function run(): Promise<void> {
const scannerResults = await readResult(outputPath);
const licenses = getLicenses(scannerResults);

// get reports
const licenseReport = 'Here are the licenses found:';
// create reports
const licensesReport = getLicensesReport(licenses);

// run policies // TODO: define run action for each policy
policies.forEach(async (policy) => await policy.run(licenseReport));
policies.forEach(async policy => await policy.run(licensesReport));

if (isPullRequest()) {
createCommentOnPR(licenseReport);
createCommentOnPR(licensesReport);
}

// set outputs for other workflow steps to use
Expand Down
Loading

0 comments on commit 5866fb9

Please sign in to comment.