Skip to content

Commit 7c4f459

Browse files
meysholdtona-agent
andcommitted
Handle already-fixed and no-alert cases in automation prompts
Agent outputs NO_ALERT or ALREADY_FIXED and stops early, skipping verify and PR steps. Co-authored-by: Ona <no-reply@ona.com>
1 parent e21bc87 commit 7c4f459

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

.ona/fix-codescan-alert.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ action:
3131
code scanning alert. Extract the alert number, HTML URL, rule ID, severity,
3232
file path and line number, tool name, and message.
3333
34-
Then apply the fix:
34+
If the file is empty, null, or contains no alert, output
35+
"NO_ALERT: No open code scanning alerts found." and stop.
36+
37+
Read the affected source file. If the issue described in the alert is
38+
already fixed in the current code, output
39+
"ALREADY_FIXED: <rule-id> in <file>:<line> is already resolved." and stop.
40+
41+
Otherwise, apply the fix:
3542
- **CodeQL alerts:** Apply the minimal code change. Follow the project's
3643
code style. Use the suggested fix pattern if one is provided.
3744
- **Dependency alerts (Trivy / OSV-Scanner):** Upgrade the vulnerable

.ona/fix-dependabot-alert.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ action:
3131
Dependabot alert. Extract the alert number, package name, vulnerable and
3232
patched versions, CVE ID, CVSS score, and manifest file path.
3333
34-
Then apply the fix:
34+
If the file is empty, null, or contains no alert, output
35+
"NO_ALERT: No open Dependabot alerts found." and stop.
36+
37+
Check whether the dependency is already at or above the patched version.
38+
If so, output "ALREADY_FIXED: <package> is already at <version>." and stop.
39+
40+
Otherwise, apply the fix:
3541
1. Read the manifest file to understand how the dependency is declared.
3642
2. Upgrade the vulnerable dependency to the patched version (or newer).
3743
- If the version is in `pom.xml` properties or directly, update it there.

0 commit comments

Comments
 (0)