Skip to content

Commit

Permalink
test-8
Browse files Browse the repository at this point in the history
  • Loading branch information
jpb06 committed Feb 22, 2023
1 parent 576561f commit c08ba3a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/logic/jest/doBadgesExist.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { pathExists } from 'fs-extra';

export const doBadgesExist = async (
outputPath = './badges',
): Promise<boolean> => {
export const doBadgesExist = async (outputPath: string): Promise<boolean> => {
const files = [
'coverage-branches.svg',
'coverage-functions.svg',
Expand Down
3 changes: 2 additions & 1 deletion src/logic/jest/hasCoverageEvolved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { exec } from '@actions/exec';

export const hasCoverageEvolved = async (
badgesExist: boolean,
outputPath: string,
): Promise<boolean> => {
if (!badgesExist) {
return true;
}

const code = await exec('git diff', ['--quiet', './badges/*'], {
const code = await exec('git diff', ['--quiet', `${outputPath}/*`], {
ignoreReturnCode: true,
});

Expand Down
12 changes: 4 additions & 8 deletions src/workflow/actionWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,17 @@ export const actionWorkflow = async (): Promise<void> => {
}`,
);
const outputPath = getInput('output-folder');
if (outputPath === '') {
await generateBadges(summaryPath);
} else {
console.log('before lib call', summaryPath, outputPath);
await generateBadges(summaryPath, outputPath);
console.log('after lib call');
}
console.log('before lib call', summaryPath, outputPath);
await generateBadges(summaryPath, outputPath);
console.log('after lib call');

if (!shouldCommit) {
return info("🔶 `no-commit` set to true: badges won't be committed");
}

const badgesExist = await doBadgesExist(outputPath);

const hasEvolved = await hasCoverageEvolved(badgesExist);
const hasEvolved = await hasCoverageEvolved(badgesExist, outputPath);
if (!hasEvolved) {
return info('🔶 Coverage has not evolved, no action required.');
}
Expand Down

0 comments on commit c08ba3a

Please sign in to comment.