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

feat: allow fetch previous results for custom #71

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
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
Loading