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(engine): Implement template expression functions #154

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

daryllimyt
Copy link
Contributor

@daryllimyt daryllimyt commented Jun 6, 2024

Features

  • Implement inline function calling in template expressions
  • Invoke this using the FNS context like such:
# Just expression
${{ FNS.less_than(ACTIONS.path.to.value, int(5)) }}

# With inline typecast
${{ FNS.less_than(ACTIONS.path.to.value, int(5)) -> str }}

Security

  • We never call eval as part of this implementation
  • We only allow a strict subset of values and use a very simple subset of builtin functions

This is a prerequisite to having conditional execution.

Testing

  • Added relevant tests
  • All tests/unit/test_template_expressions.py passing

Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tracecat ❌ Failed (Inspect) Jun 6, 2024 1:08am

@daryllimyt daryllimyt requested a review from topher-lo June 6, 2024 01:09
@daryllimyt daryllimyt self-assigned this Jun 6, 2024
@daryllimyt daryllimyt added enhancement New feature or request engine Improvements or additions to the workflow engine labels Jun 6, 2024
@daryllimyt daryllimyt merged commit f24bf4c into main Jun 6, 2024
1 of 2 checks passed
@daryllimyt daryllimyt deleted the feat/template-expression-functions branch June 6, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Improvements or additions to the workflow engine enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant