-
Notifications
You must be signed in to change notification settings - Fork 81
/
hello-world-now.yaml
67 lines (62 loc) · 1.92 KB
/
hello-world-now.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: hello-world-now
description: Say hello to the world, now!
long_description: This task prints out a greeting to the entire world, after retrieving the current UTC time from an external API
doc_link: https://en.wikipedia.org/wiki/%22Hello,_World!%22_program
title_format: Say hello in {{.input.language}}
result_format:
echo_message: "{{.step.sayHello.output.message}}"
echo_when: "{{.step.sayHello.output.when}}"
allowed_resolver_usernames: []
allow_all_resolver_usernames: true
auto_runnable: true
blocked: false
hidden: false
variables:
- name: english-message
value: Hello World!
- name: spanish-message
expression: |-
// a short javascript snippet
var h = 'Hola';
var m = 'mundo';
h + ' ' + m + '!';
inputs:
- name: language
description: The language in which you wish to greet the world
legal_values: [english, spanish]
optional: true
default: english
steps:
getTime:
description: Get UTC time
idempotent: true
resources: ["worldclockapi"]
retry_pattern: minutes
action:
type: http
configuration:
url: http://worldclockapi.com/api/json/utc/now
method: GET
json_schema:
"$schema": "http://json-schema.org/draft-07/schema#"
type: object
required: [currentDateTime, isDayLightSavingsTime, dayOfTheWeek]
properties:
currentDateTime:
type: string
pattern: '^\d+-\d+-\d+T\d+:\d+Z$'
isDayLightSavingsTime:
type: boolean
dayOfTheWeek:
type: string
sayHello:
description: Echo a greeting in your language of choice
dependencies: [getTime]
action:
type: echo
configuration:
output:
message: >-
{{if (eq .input.language "english")}}{{eval "english-message"}}
{{else if (eq .input.language "spanish")}}{{eval "spanish-message"}}{{end}}
when: "{{.step.getTime.output.currentDateTime}}"