diff --git a/.gitattributes b/.gitattributes index 12a49d1bda..769a3605d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ # Make Github ignore the designs folder when determining repo language flow/designs/src/* linguist-vendored -flow/scripts/variables.json linguist-generated=true diff --git a/.github/workflows/github-actions-yaml-test.yml b/.github/workflows/github-actions-yaml-test.yml index 5c4e30aa00..4ba26bc9ff 100644 --- a/.github/workflows/github-actions-yaml-test.yml +++ b/.github/workflows/github-actions-yaml-test.yml @@ -18,9 +18,7 @@ jobs: fetch-depth: 1 sparse-checkout: | flow/scripts/generate-variables-docs.py - flow/scripts/yaml_to_json.py flow/scripts/variables.yaml - flow/scripts/variables.json docs/user/FlowVariables.md yamlfix.toml .github/requirements/requirements_lock.txt @@ -37,10 +35,6 @@ jobs: - name: Check if FlowVariables.md is up to date run: | git diff --exit-code docs/user/FlowVariables.md - - name: Check variables.json is up to date - run: | - venv/bin/python3 flow/scripts/yaml_to_json.py - git diff --exit-code flow/scripts/variables.json - name: Run yamlfix check run: | source venv/bin/activate diff --git a/flow/scripts/defaults.py b/flow/scripts/defaults.py index b0c8a112b1..3c8f779d39 100755 --- a/flow/scripts/defaults.py +++ b/flow/scripts/defaults.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 -import json import os +import yaml dir_path = os.path.dirname(os.path.realpath(__file__)) -json_path = os.path.join(dir_path, "variables.json") -with open(json_path, "r") as file: - data = json.load(file) +yaml_path = os.path.join(dir_path, "variables.yaml") +with open(yaml_path, "r") as file: + data = yaml.safe_load(file) for key, value in data.items(): if value.get("default", None) is None: diff --git a/flow/scripts/non_stage_variables.py b/flow/scripts/non_stage_variables.py index 08cbe9dc57..28e52f2e05 100755 --- a/flow/scripts/non_stage_variables.py +++ b/flow/scripts/non_stage_variables.py @@ -5,15 +5,15 @@ # # This script generates a list of variables known # not to be in the current stage. -import json import os import sys +import yaml dir_path = os.path.dirname(os.path.realpath(__file__)) -json_path = os.path.join(dir_path, "variables.json") -with open(json_path, "r") as file: - data = json.load(file) +yaml_path = os.path.join(dir_path, "variables.yaml") +with open(yaml_path, "r") as file: + data = yaml.safe_load(file) for key, value in data.items(): if "stages" not in value: diff --git a/flow/scripts/yaml_to_json.py b/flow/scripts/yaml_to_json.py deleted file mode 100755 index 5ccaa20f05..0000000000 --- a/flow/scripts/yaml_to_json.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 -"""Convert variables.yaml to variables.json. - -Run this whenever variables.yaml is modified. -Requires PyYAML (pip install pyyaml). -""" - -import json -import os - -import yaml - -dir_path = os.path.dirname(os.path.realpath(__file__)) -yaml_path = os.path.join(dir_path, "variables.yaml") -json_path = os.path.join(dir_path, "variables.json") - -with open(yaml_path, "r") as f: - data = yaml.safe_load(f) - -with open(json_path, "w") as f: - json.dump(data, f, indent=2, sort_keys=True) - f.write("\n")