File tree Expand file tree Collapse file tree 2 files changed +5
-29
lines changed Expand file tree Collapse file tree 2 files changed +5
-29
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
2
-
3
- # PROPRIETARY AND CONFIDENTIAL
4
- #
5
- # Unauthorized copying of this project via any medium is strictly prohibited.
6
- #
7
- # Copyright (c) 2020-2020 Snowplow Analytics Ltd. All rights reserved.
8
-
9
- # Generate the JSON equivalent of the yaml file with the list of referers
10
-
11
1
import sys
12
- import json
13
2
import yaml
3
+ import json
14
4
15
- if len(sys.argv) ! = 3:
16
- print ' USAGE: yaml_to_json.py <input_referers.yaml> <output_referers.json>'
17
- print ' 2 arguments must be specified'
18
- print ' Arguments:'
19
- print sys.argv[1:]
20
- sys.exit(1)
21
-
22
- input_yaml = sys.argv[1]
23
- output_json = sys.argv[2]
24
-
25
- referers = yaml.load(open(input_yaml))
26
- json = json.dumps(referers, sort_keys = False, indent = 4)
5
+ with open (sys .argv [1 ], 'r' ) as input :
6
+ yml = yaml .safe_load (input )
27
7
28
- print " writing to {0} " .format(output_json)
29
- with open(output_json, ' w' ) as f:
30
- f.write(json)
8
+ with open (sys .argv [2 ], 'w' ) as output :
9
+ json .dump (yml , output )
Original file line number Diff line number Diff line change 7
7
runs-on : ubuntu-latest
8
8
steps :
9
9
- uses : actions/checkout@v3
10
- # - uses: actions/setup-python@v4
11
- # with:
12
- # python-version: '2.7.0'
13
10
- name : Convert yaml to json
14
11
run : python .github/workflows/lib/yaml_to_json.py resources/referers.yml referers.json
15
12
- name : Check
You can’t perform that action at this time.
0 commit comments