mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-28 03:30:10 +00:00
Add current_date to reserved parameters list (#SKY-7547) (#4854)
This commit is contained in:
parent
e6db283069
commit
a520559856
4 changed files with 20 additions and 1 deletions
|
|
@ -54,7 +54,14 @@ Pick the credential to use when running the workflow when you have defined a cre
|
|||
|
||||
## Reserved Parameters
|
||||
There are some parameters that are reserved by Skyvern and cannot be used as a parameter key/name:
|
||||
- `{{current_value}}`: this is a reserved parameter within the scope of a for loop block. It represents the current value that the loop is iterating over.
|
||||
- `{{current_item}}`: the current item in a for-loop block iteration (alias for `current_value`).
|
||||
- `{{current_value}}`: the current value that the for-loop block is iterating over.
|
||||
- `{{current_index}}`: the zero-based index of the current for-loop iteration.
|
||||
- `{{current_date}}`: automatically resolves to the current date in YYYY-MM-DD format (UTC).
|
||||
- `{{workflow_title}}`: the title of the workflow.
|
||||
- `{{workflow_id}}`: the unique ID of the workflow definition.
|
||||
- `{{workflow_permanent_id}}`: the permanent ID that persists across workflow versions.
|
||||
- `{{workflow_run_id}}`: the unique ID of the current workflow run.
|
||||
|
||||
## Block Output Parameters
|
||||
Any block name ({{your_block_name}} or {{your_block_name_output}}) can be referenced as a parameter by a later block, with the exception of referencing a block within a for loop from outside of the for loop block.
|
||||
|
|
|
|||
|
|
@ -180,6 +180,11 @@ function WorkflowParameterEditPanel({
|
|||
"current_item",
|
||||
"current_value",
|
||||
"current_index",
|
||||
"current_date",
|
||||
"workflow_title",
|
||||
"workflow_id",
|
||||
"workflow_permanent_id",
|
||||
"workflow_run_id",
|
||||
"workflow_run_outputs",
|
||||
];
|
||||
const isCloud = useContext(CloudContext);
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ else:
|
|||
jinja_sandbox_env = SandboxedEnvironment()
|
||||
|
||||
|
||||
# Date format used for the built-in {{current_date}} reserved parameter.
|
||||
CURRENT_DATE_FORMAT = "%Y-%m-%d"
|
||||
|
||||
# Sentinel marker for native JSON type injection via | json filter.
|
||||
_JSON_TYPE_MARKER = "__SKYVERN_RAW_JSON__"
|
||||
|
||||
|
|
@ -399,6 +402,8 @@ class Block(BaseModel, abc.ABC):
|
|||
template_data["workflow_permanent_id"] = workflow_run_context.workflow_permanent_id
|
||||
if "workflow_run_id" not in template_data:
|
||||
template_data["workflow_run_id"] = workflow_run_context.workflow_run_id
|
||||
if "current_date" not in template_data:
|
||||
template_data["current_date"] = datetime.now(timezone.utc).strftime(CURRENT_DATE_FORMAT)
|
||||
|
||||
template_data["workflow_run_outputs"] = workflow_run_context.workflow_run_outputs
|
||||
template_data["workflow_run_summary"] = workflow_run_context.build_workflow_run_summary()
|
||||
|
|
@ -5059,6 +5064,7 @@ class BranchEvaluationContext:
|
|||
template_data.setdefault("workflow_id", ctx.workflow_id)
|
||||
template_data.setdefault("workflow_permanent_id", ctx.workflow_permanent_id)
|
||||
template_data.setdefault("workflow_run_id", ctx.workflow_run_id)
|
||||
template_data.setdefault("current_date", datetime.now(timezone.utc).strftime(CURRENT_DATE_FORMAT))
|
||||
|
||||
template_data.setdefault("params", template_data.get("params", {}))
|
||||
template_data.setdefault("outputs", template_data.get("outputs", {}))
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ RESERVED_PARAMETER_KEYS = [
|
|||
"current_item",
|
||||
"current_value",
|
||||
"current_index",
|
||||
"current_date",
|
||||
"workflow_title",
|
||||
"workflow_id",
|
||||
"workflow_permanent_id",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue