Skip to content

Commit

Permalink
Updated runner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 20, 2024
1 parent c9f4d73 commit 8e7a09a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 9 additions & 15 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ def main():
# Extract `types` folder
with zipfile.ZipFile("openai-latest.zip", "r") as zip_ref:
zip_ref.extractall("openai-package")
# remove openai-latest.zip
os.remove("openai-latest.zip")

os.makedirs("temp_types", exist_ok=True)
os.makedirs("temp_types/types", exist_ok=True)
source_dir = f"openai-package/openai-python-{str(latest_release)[1:]}/src/openai/types"
dest_dir = "temp_types/types"

shutil.move(source_dir, dest_dir)
shutil.rmtree("openai-package")

# Configure git
run_command('git config --global user.name "GitHub Actions"')
Expand All @@ -51,16 +41,20 @@ def main():
except subprocess.CalledProcessError:
run_command(f"git checkout -b openai-types-extracted-{latest_release}")

# remove openai-latest.zip
os.remove("openai-latest.zip")

source_dir = f"openai-package/openai-python-{str(latest_release)[1:]}/src/openai/types"
dest_dir = "lmos_openai_types"

# Ensure lmos_openai_types directory exists
os.makedirs("lmos_openai_types", exist_ok=True)
os.mkdir("lmos_openai_types", exist_ok=True)

# Remove the existing types directory if it exists
shutil.rmtree("lmos_openai_types/types", ignore_errors=True)

os.makedirs("lmos_openai_types/types", exist_ok=True)

# Move the new types into place
shutil.move("temp_types", "lmos_openai_types/types")
shutil.move(source_dir, dest_dir)
shutil.rmtree("openai-package")

# Add all changes
run_command("git add .")
Expand Down

0 comments on commit 8e7a09a

Please sign in to comment.