Skip to content
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: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ inputs:
fail-on:
description: 'Minimum severity level to fail the action (critical, high, medium, low, info)'
required: false
default: 'high'
comment-on:
description: 'Minimum severity level to show annotations in code review (critical, high, medium, low, info)'
required: false
default: 'medium'
max-findings:
description: 'Maximum number of findings to report (0 for unlimited)'
required: false
Expand Down Expand Up @@ -75,6 +80,7 @@ runs:
INPUT_GITHUB_TOKEN: ${{ inputs.github-token }}
INPUT_CONFIG_PATH: ${{ inputs.config-path }}
INPUT_FAIL_ON: ${{ inputs.fail-on }}
INPUT_COMMENT_ON: ${{ inputs.comment-on }}
INPUT_MAX_FINDINGS: ${{ inputs.max-findings }}
INPUT_PARALLEL: ${{ inputs.parallel }}
CLAUDE_CODE_PATH: ${{ env.HOME }}/.local/bin/claude
Expand Down
16 changes: 12 additions & 4 deletions src/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface ActionInputs {
githubToken: string;
configPath: string;
failOn?: 'critical' | 'high' | 'medium' | 'low' | 'info';
commentOn?: 'critical' | 'high' | 'medium' | 'low' | 'info';
maxFindings: number;
/** Max concurrent trigger executions */
parallel: number;
Expand Down Expand Up @@ -59,17 +60,24 @@ function getInputs(): ActionInputs {
);
}

const validSeverities = ['critical', 'high', 'medium', 'low', 'info'] as const;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated severity validation list instead of reusing existing type

Low Severity

The validSeverities array duplicates the severity values already defined in SeveritySchema from src/types/index.ts. The CLI (src/cli/args.ts) correctly imports and uses SeveritySchema for validation, but this action code manually redefines the same list. This creates a maintenance burden where changes to valid severity levels need to be updated in multiple places. The existing SeveritySchema.options could be used instead.

Fix in Cursor Fix in Web


const failOnInput = getInput('fail-on');
const validFailOn = ['critical', 'high', 'medium', 'low', 'info'] as const;
const failOn = validFailOn.includes(failOnInput as typeof validFailOn[number])
? (failOnInput as typeof validFailOn[number])
const failOn = validSeverities.includes(failOnInput as typeof validSeverities[number])
? (failOnInput as typeof validSeverities[number])
: undefined;

const commentOnInput = getInput('comment-on');
const commentOn = validSeverities.includes(commentOnInput as typeof validSeverities[number])
? (commentOnInput as typeof validSeverities[number])
: undefined;

return {
anthropicApiKey,
githubToken: getInput('github-token') || process.env['GITHUB_TOKEN'] || '',
configPath: getInput('config-path') || 'warden.toml',
failOn,
commentOn,
maxFindings: parseInt(getInput('max-findings') || '50', 10),
parallel: parseInt(getInput('parallel') || String(DEFAULT_CONCURRENCY), 10),
};
Expand Down Expand Up @@ -501,7 +509,7 @@ async function run(): Promise<void> {
}

const failOn = trigger.output.failOn ?? inputs.failOn;
const commentOn = trigger.output.commentOn;
const commentOn = trigger.output.commentOn ?? inputs.commentOn;

try {
const skill = await resolveSkillAsync(trigger.skill, repoPath, config.skills);
Expand Down
6 changes: 6 additions & 0 deletions warden.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
version = 1

[defaults.output]
# Fail check on high+ severity findings (critical, high)
failOn = "high"
# Show annotations for medium+ severity findings
commentOn = "medium"

[[triggers]]
name = "security-review"
event = "pull_request"
Expand Down