-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,35 @@ | ||
name: Extract OpenAI Types | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: # Allow manual triggering | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
extract-types: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Check out the repository | ||
- name: Checkout current repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Fetch the latest OpenAI release | ||
- name: Download latest OpenAI release zip | ||
run: | | ||
# Get the latest release version number | ||
latest_release=$(curl -s https://api.github.com/repos/openai/openai-python/releases/latest | jq -r '.tag_name') | ||
# Download the latest release zip | ||
curl -L https://github.com/openai/openai-python/archive/refs/tags/${latest_release}.zip -o openai-latest.zip | ||
curl -L "https://github.com/openai/openai-python/archive/refs/tags/${latest_release}.zip" -o openai-latest.zip | ||
# Step 3: Extract the `types` folder from the release | ||
- name: Extract `types` folder | ||
run: | | ||
# Unzip the archive | ||
unzip openai-latest.zip -d openai-package | ||
# Copy only the /src/openai/types folder | ||
mkdir -p lmos-openai-types | ||
cp -r lmos-openai-types/openai-python-${latest_release}/src/openai/types openai-types/ | ||
cp -r openai-package/openai-python-*/src/openai/types lmos-openai-types/ | ||
# Step 4: Commit the extracted types to a new branch | ||
- name: Commit and push changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Configure git | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "actions@github.com" | ||
# Create a new branch | ||
git checkout -b openai-types-extracted | ||
# Add the new files | ||
git add lmos-openai-types | ||
# Commit the changes | ||
git commit -m "Extracted types from OpenAI ${latest_release}" | ||
# Push the new branch | ||
git push origin openai-types-extracted | ||
git push origin openai-types-extracted |