Orchestrator

Configure a Workflow

Content is machine translated from English by Phrase Language AI.

To continue with the sample workflow, it will need to be configured.

Block configuration can be accessed by either clicking Edit parameters on the Configure tab, or right-clicking the block and selecting Edit parameters to open the Edit parameters window. Once a block has parameters, the Add parameters button switches to Edit parameters.

To configure the blocks for the example, follow these steps:

  1. Open the Edit parameters window for the language-blue.svgList locales action.

  2. The Access token and Project fields will require dynamic values that are resolved at runtime.

    1. Click the link icon Orc_link.jpg for the Access token field and select the circle-blue.svgFetch access tokens action.

      The link turns green and the field can be edited.

    2. The syntax for accessing the properties of a referenced trigger or action is:

      {{$.path.to.value}}

      With the output for circle-blue.svgFetch access tokens being:

      { "tokens": {"strings_token": "STRINGS_TOKEN", "tms_token": "TMS_TOKEN"} }

      making the expression required for the Access token field {{$.tokens.strings_token}}.

    3. Click the link icon Orc_link.jpg for the Project field and select the history-orange.svguploads:create trigger.

      The link turns green and the field can be edited.

    4. The output of the history-orange.svguploads:create trigger resembles:

      {
        "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 Project field {{$.project.id}}.

    5. Click Save.

      The Edit parameters windows closes and the parameters for the action are saved

  3. The project's default locale is required to create a job by passing the ID to the work-blue.svgCreate Job action. The circle-blue.svgTransform JSON with jq action takes a JSON input, applies the filter specified and then outputs JSON again

    1. From the Actions tab on the Workflow blocks window, search for phrase-jq.

      Drag and drop the circle-blue.svgTransform JSON with jq action block below the language-blue.svglist locales action to connect them.

    2. Open the Edit parameters window for the Transform JSON with jq action.

    3. Select JSON from the Input Type dropdown field.

    4. Click the link icon Orc_link.jpg for the Input field and select the language-blue.svglist locales action.

      The link turns green and the field can be edited.

    5. The Input 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 Input field.

    6. Click the link icon Orc_link.jpg for the Jq field and select the language-blue.svglist locales action.

      The link turns green and the field can be edited.

    7. A filter of the list of locales that returns a new list containing all elements where the default property is true 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 Jq field.

    8. Click Save.

      The Edit parameters windows closes and the parameters for the action are saved

  4. The work-blue.svgCreate a job action can now be configured and will use patterns from previous blocks.

    1. Click the link icon Orc_link.jpg for the Access token field and select the circle-blue.svgFetch access tokens action.

      The link turns green and the field can be edited.

      Enter the expression {{$.tokens.strings_token}}.

    2. Click the link icon Orc_link.jpg for the Project field and select the language-orange.svguploads:create trigger.

      The link turns green and the field can be edited.

      Enter the expression {{$.project.id}}.

    3. Click the link icon Orc_link.jpg for the Source locale field and select the Transform JSON with jq action.

      The link turns green and the field can be edited.

      Enter the expression {{@.outputs.result}}.

    4. 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 Due date field, enter 2023-12-31T12:00:00Z.

    5. Click Save.

      The configuration is saved and details can be viewed in the Configure tab.

  5. Every action can have one or more conditions combined with logical AND and OR. 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 work-blue.svgCreate a job action selected, click Edit conditions from the Conditions tab or right-click the block and select Edit conditions.

    The Edit conditionals window opens.

    1. Following patterns from previous blocks, link the variable field to the language-orange.svguploads:create trigger and enter the expression {{$.upload.tag}}.

    2. Select NOT from the first dropdown list to invert the statement.

    3. Select IsNull from the compare dropdown list.

    4. Click Save.

      The condition is presented on the Conditions 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).

  6. 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 circle-blue.svgTransform JSON with jq actions in the Edit parameters window as in step 3.

    1. In the Input field of both actions, enter the expression {{@.outputs.result}}, link to the language-blue.svgList locales action and save the parameter.

    2. In the Jg field of one action, enter the expression map(select(.name == "es-ES"))|.[0] and link to the language-blue.svgList locales action.

      Save the parameter.

    3. In the second action, enter the expression map(select(.name == "de-DE"))|.[0] and link to the language-blue.svgList locales action.

      Save the parameter.

  7. The locales will now be applied to job creation.

    Configure the two work-blue.svgAdd a target locale to a job actions with the same patterns previously defined.

  8. The job can now be started.

    Configure the work-blue.svgStart a job action with the same patterns as previously defined.

Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.