You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b8f47f1
Browse filesBrowse the repository at this point in the historyBrowse files
Validate that step references in conditions (steps.foo) point to steps
that exist and come before the current step. This catches forward
references, self-references, and typos at validation time.
Compile (compile.go):
- Add stepRefFinder AST visitor to find steps.X patterns
- Add ExtractStepRefs() to extract step names from expressions
- Handle both dot notation (steps.foo) and bracket notation (steps["foo"])
Validation (validate.go):
- Add validateStepRefs() to check step references
- Detect unknown steps, forward references, and self-references
- Expand aliases to check step refs hidden in alias definitions
- Distinct error messages for each case
Documentation (README.md):
- Add "Step references" paragraph in Condition Expressions section
Tests:
- Add TestExtractStepRefs with 8 cases (dot, bracket, string literal, dedup)
- Add TestValidate_StepReferences with 6 cases (valid, unknown, forward, alias, self, multiple)
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1778,6 +1778,8 @@ Aliases are expanded at compile time, so `"found && is_owner"` becomes `"(steps.
1778
1778
1779
1779
**Division safety:** Conditions with dynamic divisors must use `divOr(a, b, fallback)` instead of `a / b`. This prevents runtime panics from division by zero. Division by literal non-zero values (e.g., `x / 2`) is allowed. Violations are caught at workflow compile time.
1780
1780
1781
+
**Step references:** Conditions using `steps.X` are validated at compile time. Steps can only reference results from earlier steps - forward references and self-references are errors. Unknown step names are also caught.
0 commit comments