Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion update_workflow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

import os
from pathlib import Path
import requests
import yaml
Expand All @@ -17,10 +18,12 @@

proj = input(f"Enter project name (default: {'PROJECT_NAME'}): ").strip() or 'PROJECT_NAME'

pwd = os.path.dirname(__file__)

CENTRAL_REPO_ORG = "Billingegroup"
CENTRAL_REPO_NAME = "release-scripts"
CENTRAL_WORKFLOW_DIR = ".github/workflows/templates"
LOCAL_WORKFLOW_DIR = Path("../"+proj+"/.github/workflows")
LOCAL_WORKFLOW_DIR = Path(pwd + "/../"+proj+"/.github/workflows")

user_input_cache = {'project': proj}

Expand Down Expand Up @@ -75,6 +78,14 @@ def update_local_workflows(central_workflows):
central_yaml = update_workflow_params(central_yaml)
with open(local_file, 'w', encoding='utf-8') as file:
yaml.dump(central_yaml, file, Dumper=CoreDumper, sort_keys=False)

with open(local_file, 'r', encoding='utf-8') as file:
content = file.read()
parts = content.split('jobs', 1)
parts[0] = parts[0].replace('-', ' -')
content = 'jobs'.join(parts)
with open(local_file, 'w', encoding='utf-8') as file:
file.write(content)

for name in local_workflows - central_workflow_names:
(LOCAL_WORKFLOW_DIR / name).unlink()
Expand Down