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

[CSR-1991] feat: add use-api option #22

Merged
merged 2 commits into from
Dec 17, 2024
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
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Playwright Last Failed'
description:
'The action helps to run last failed Playwright tests using Currents cache'
author: 'vCaisim'
author: 'Currents Software Inc'

inputs:
key:
Expand Down Expand Up @@ -36,6 +36,10 @@ inputs:
description: 'The total number of matrices available'
required: false
default: '1'
use-api:
description: 'Use Currents API for obtaining the list of failed tests'
required: false
default: 'false'
or8n:
description: 'Enable or8n integration'
required: false
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions dist/index.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/post.js

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

7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { parseIntSafe, parseTemplate, parseYamlBoolean } from './utils'

// Define interface for inputs
interface ActionInputs {
useAPI: boolean
or8n: boolean
debug: boolean
matrixIndex: string
Expand All @@ -22,6 +23,7 @@ interface ActionInputs {
// Get inputs with types
function getInputs(): ActionInputs {
return {
useAPI: parseYamlBoolean(core.getInput('use-api')) ?? false,
or8n: parseYamlBoolean(core.getInput('or8n')) ?? false,
debug: parseYamlBoolean(core.getInput('debug')) ?? false,
apiKey: core.getInput('api-key') ?? process.env.CURRENTS_API_KEY,
Expand All @@ -43,8 +45,9 @@ async function run(): Promise<void> {

await exec.exec('npm install -g @currents/cmd')

core.saveState('or8n', inputs.or8n)
if (inputs.or8n) {
const useAPI = inputs.useAPI || inputs.or8n
core.saveState('or8n', useAPI)
if (useAPI) {
await or8n(inputs)
return
}
Expand Down
3 changes: 2 additions & 1 deletion src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ interface PostState {

function getPostState(): PostState {
return {
or8n: core.getState('or8n') === 'true',
or8n:
core.getState('or8n') === 'true' || core.getState('useAPI') === 'true',
key: core.getState('key') ?? process.env.CURRENTS_RECORD_KEY,
debug: core.getState('debug') === 'true',
id: core.getState('id'),
Expand Down
Loading