diff --git a/README.md b/README.md index 7f7195c6..df42b68d 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,8 @@ For test annotations, add the `annotate` argument to your workflow yaml: - `--exit-on-fail`: Sets the action status to failed when a failed tests is found - `--use-suite-name`: Prefix test name with suite name +- `--fetch-previous-results`: Always fetch previous workflow runs when using + custom templates ## Storing Artifacts diff --git a/package-lock.json b/package-lock.json index 89d1f78a..dcab0fc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "github-actions-ctrf", - "version": "0.0.57", + "version": "0.0.58", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "github-actions-ctrf", - "version": "0.0.57", + "version": "0.0.58", "license": "MIT", "dependencies": { "@actions/core": "^1.11.1", diff --git a/package.json b/package.json index 73df2540..76e07e09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-actions-ctrf", - "version": "0.0.57", + "version": "0.0.58", "description": "View test results directly within your GitHub workflow summary and Pull Requests", "main": "index.js", "scripts": { diff --git a/src/core/cli.ts b/src/core/cli.ts index a89c4f46..ccd9b974 100644 --- a/src/core/cli.ts +++ b/src/core/cli.ts @@ -1,4 +1,6 @@ #!/usr/bin/env node +process.env.RUN_MODE = 'cli' + import yargs from 'yargs/yargs' import { hideBin } from 'yargs/helpers' import { exitActionOnFail, getAllGitHubContext, handleError } from '../github' @@ -34,6 +36,7 @@ export interface Arguments { commentTag?: string results?: number exitOnFail?: boolean + fetchPreviousResults?: boolean } async function main(): Promise { @@ -315,6 +318,11 @@ async function main(): Promise { type: 'string', description: 'Tag to use to match Pull Request comments with' }) + .options('fetch-previous-results', { + type: 'boolean', + description: + 'Always fetch previous workflow runs when using custom templates.' + }) .help() .alias('help', 'h') .parseSync() diff --git a/src/core/inputs.ts b/src/core/inputs.ts index eb419efa..f0830729 100644 --- a/src/core/inputs.ts +++ b/src/core/inputs.ts @@ -36,7 +36,7 @@ export function getCliInputs(args: Arguments): Inputs { useSuiteName: args.useSuiteName || false, previousResultsMax: args.rows || 10, metricsReportsMax: args.results || 100, - fetchPreviousResults: args._.includes('fetch-previous-results'), + fetchPreviousResults: args.fetchPreviousResults || false, updateComment: args.updateComment || false, overwriteComment: args.overwriteComment || false, commentTag: args.commentTag || '',