Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep measurements after action finishes #122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions dist/packages/user-flow-gh-action/main.js

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

2 changes: 1 addition & 1 deletion dist/packages/user-flow-gh-action/main.js.map

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions packages/user-flow-gh-action/src/app/executeUFCI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,24 @@ describe('executeUFCI mock', () => {
expect(res).toBe(`Execute CLI: npx @push-based/user-flow collect ${paramsFormatted.join(', ')}`);
}));

test('adds markdown format if missing', withProject(prjCfg, async () => {
const rcObj = {
"url": "https://google.com",
"ufPath": "./user-flows",

"outPath": "./packages/user-flow-gh-action-e2e/measures",
"format": [
"html"
]
};
const run = (bin: string, args: string[]) => {
return `Execute CLI: npx @push-based/user-flow collect ${args.join(', ')}` as any;
};

const params = {...rcObj, verbose: true, dryRun: false} as unknown as any;
const res = await executeUFCI((params), run);
const paramsFormatted = processParamsToParamsArray({...rcObj, verbose: true, dryRun: false, format: ['html', 'md']});
expect(res).toBe(`Execute CLI: npx @push-based/user-flow collect ${paramsFormatted.join(', ')}`);
}));

});
9 changes: 7 additions & 2 deletions packages/user-flow-gh-action/src/app/executeUFCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ export async function executeUFCI(
run: (bin: string, args: string[]) => any = runUserFlowCliCommand
): Promise<string> {
return new Promise((resolve) => {
// override format
ghActionInputs.format = ['md'];
// append markdown format
// ghActionInputs.format can be an array containing an empty string
if (!ghActionInputs.format || (ghActionInputs.format.length === 1 && !ghActionInputs.format[0]) ) {
ghActionInputs.format = ['md'];
} else if (!ghActionInputs.format.includes('md')) {
ghActionInputs.format.push('md');
}

const command = 'collect';
const script = `npx @push-based/user-flow ${command}`;
Expand Down
4 changes: 0 additions & 4 deletions packages/user-flow-gh-action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ export async function run(): Promise<void> {
try {
core.startGroup(`Process results`);
const {resultSummary, resultPath} = processResult(resultsOutPath);
// cleanup tmp folder
if (existsSync(resultsOutPath)) {
rmdirSync(resultsOutPath, {recursive: true});
}

core.setOutput('resultPath', resultPath);
core.setOutput('resultSummary', resultSummary);
Expand Down