Skip to content

Commit

Permalink
feat: allow fetch previous results for custom
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma11hewThomas committed Jan 13, 2025
1 parent 3c5d8e3 commit a1fda7b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions src/core/cli.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -34,6 +36,7 @@ export interface Arguments {
commentTag?: string
results?: number
exitOnFail?: boolean
fetchPreviousResults?: boolean
}

async function main(): Promise<void> {
Expand Down Expand Up @@ -315,6 +318,11 @@ async function main(): Promise<void> {
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()
Expand Down
2 changes: 1 addition & 1 deletion src/core/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '',
Expand Down

0 comments on commit a1fda7b

Please sign in to comment.