1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # ./yaml.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | log() {
|
11 | echo "$@" >& 2
|
12 | }
|
13 |
|
14 | travis() {
|
15 | local out='.travis.yml'
|
16 | devtools/yaml2json.py .travis.yml.in > $out
|
17 | log "Wrote $out"
|
18 | }
|
19 |
|
20 | sourcehut() {
|
21 | local out='.builds/create-cache.yml'
|
22 | devtools/yaml2json.py .builds/create-cache.yml.in > $out
|
23 | log "Wrote $out"
|
24 | }
|
25 |
|
26 | github-actions() {
|
27 | ### Validate and print to stdout
|
28 | devtools/yaml2json.py .github/workflows/all-builds.yml
|
29 | }
|
30 |
|
31 | bug() {
|
32 | # This is wrong: should be 100, not "1e2"
|
33 |
|
34 | devtools/yaml2json.py <<EOF
|
35 | {"foo": 1e2}
|
36 | EOF
|
37 |
|
38 | # Uh this is also wrong
|
39 | devtools/yaml2json.py <<EOF
|
40 | %YAML 1.2
|
41 | ---
|
42 | {"foo": 1e2}
|
43 | EOF
|
44 | }
|
45 |
|
46 | "$@"
|