To continue with the sample workflow, it will need to be configured.
Block configuration can be accessed by either clicking Edit parameters on the tab, or right-clicking the block and selecting Edit parameters to open the window. Once a block has parameters, the button switches to .
To configure the blocks for the example, follow these steps:
-
Open the
window for the
action.List locales
-
The
and fields will require dynamic values that are resolved at runtime.-
Click the link icon
for the field and select the
action.Fetch access tokens
The link turns green and the field can be edited.
-
The syntax for accessing the properties of a referenced trigger or action is:
{{$.path.to.value}}
With the output for
being:Fetch access tokens
{ "tokens": {"strings_token": "STRINGS_TOKEN", "tms_token": "TMS_TOKEN"} }
making the expression required for the
field{{$.tokens.strings_token}}
. -
Click the link icon
for the field and select the
trigger.uploads:create
The link turns green and the field can be edited.
-
The output of the
trigger resembles:uploads:create
{ "branch": { "name": "my_branch" }, "event": "uploads:create", "message": "user-1 initialized file upload file.yml in project name_1672734591_11 within branch my_branch\n", "project": { "created_at": "2023-01-03 08:29:51 UTC", "id": "abcdabcdabcdabcd-11", "main_format": "yml", "name": "name_1672734591_10", "point_of_contact": null, "project_image_url": null, "slug": "name_1672734591_10", "updated_at": "2023-01-03 08:29:51 UTC" }, "upload": { "created_at": "2023-01-03 08:29:48 UTC", "filename": "file.yml", "format": "yml", "id": "upload-1", "state": "initialized", "summary": {}, "tag": null, "updated_at": "2023-01-03 08:29:48 UTC" }, "user": { "gravatar_uid": "29a2d1baa67d4ea524cf0f247f7bbb94", "id": "9c365b9a6f77c247c3de959f6152b231", "name": "Joe Sixpack", "username": "user-1" } }
making the expression required for the
field{{$.project.id}}
. -
Click Save.
The
windows closes and the parameters for the action are saved
-
-
The project's default locale is required to create a job by passing the ID to the
action. TheCreate Job
action takes a JSON input, applies the filter specified and then outputs JSON againTransform JSON with jq
-
From the phrase-jq.
tab on the window, search forDrag and drop the
action block below theTransform JSON with jq
action to connect them.list locales
-
Open the
window for theTransform JSON with jq
action. -
Select
from the dropdown field. -
Click the link icon
for the field and select the
action.list locales
The link turns green and the field can be edited.
-
The
field takes the JSON input. A special fixed expression (@
instead of$
) ensures that the entire output of the referenced action gets passed into the field.Enter the expression
{{@.outputs.result}}
in the field. -
Click the link icon
for the field and select the
action.list locales
The link turns green and the field can be edited.
-
A filter of the list of locales that returns a new list containing all elements where the
default
property istrue
is required.There can only be one default locale per project and the list has one identifiable and required element. That element is directly accessed with the
.[0]
array syntax.Enter the expression
map(select(.default))|.[0]
in the field. -
Click Save.
The
windows closes and the parameters for the action are saved
-
-
The
action can now be configured and will use patterns from previous blocks.Create a job
-
Click the link icon
for the field and select the
action.Fetch access tokens
The link turns green and the field can be edited.
Enter the expression
{{$.tokens.strings_token}}
. -
Click the link icon
for the field and select the
trigger.uploads:create
The link turns green and the field can be edited.
Enter the expression
{{$.project.id}}
. -
Click the link icon
for the field and select the
Transform JSON with jq
action.The link turns green and the field can be edited.
Enter the expression
{{@.outputs.result}}
. -
The due date can be calculated with sprig or Expr functions, but for purposes of this example a hardcoded date understood by the API will be used.
In the 2023-12-31T12:00:00Z.
field, enter -
Click Save.
The configuration is saved and details can be viewed in the
tab.
-
-
Every action can have one or more conditions combined with logical
AND
andOR
. These conditions are evaluated in runtime and the action and its children will only execute if the condition evaluates to true.To reflect this in the example, while having the
action selected, click Edit conditions from the tab or right-click the block and select Edit conditions.Create a job
The
window opens.-
Following patterns from previous blocks, link the
field to the
trigger and enter the expressionuploads:create
{{$.upload.tag}}
. -
Select NOT from the first dropdown list to invert the statement.
-
Select IsNull from the dropdown list.
-
Click Save.
The condition is presented on the
tab.
The workflow will stop at this point if the upload does not contain a tag (meaning that there were no new/updated keys/translations).
-
-
Target locales are now required for the job. For the purposes of the example, two locales will be created; one for Spanish (es-ES) and one for German (de-DE). Locales will be added to the two
actions in the window as in step 3.Transform JSON with jq
-
In the
field of both actions, enter the expression{{@.outputs.result}}
, link to the
action and save the parameter.List locales
-
In the
field of one action, enter the expressionmap(select(.name == "es-ES"))|.[0]
and link to the
action.List locales
Save the parameter.
-
In the second action, enter the expression
map(select(.name == "de-DE"))|.[0]
and link to the
action.List locales
Save the parameter.
-
-
The locales will now be applied to job creation.
Configure the two
actions with the same patterns previously defined.Add a target locale to a job
-
The job can now be started.
Configure the
action with the same patterns as previously defined.Start a job