Skip to content

Commit

Permalink
feat(.github): Create generate-openapi-code-from-typespec (#746)
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->



> [!IMPORTANT]
> Add GitHub Actions workflow to generate OpenAPI code from TypeSpec,
with environment setup and caching.
> 
>   - **Workflow**:
> - New GitHub Actions workflow `generate-openapi-code-from-typespec`
added.
>     - Triggers on `pull_request` and `push` events.
>   - **Environment Setup**:
>     - Uses `actions/setup-python@v5` to set Python 3.12.
>     - Uses `actions/setup-node@v4` to set up Node.js with npm caching.
> - Configures Poetry with `snok/install-poetry@v1` and sets virtualenvs
in-project.
>   - **Caching**:
> - Caches Poetry virtualenv in `agents-api/.venv` using
`actions/cache@v4`.
>   - **Code Generation**:
> - Runs `scripts/generate_openapi_code.sh` to generate OpenAPI code.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup>
for 25acd5b. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
  • Loading branch information
creatorrr and ellipsis-dev[bot] authored Oct 26, 2024
1 parent bb6b238 commit 4f50d9e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/generate-openapi-code-from-typespec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Generate OpenAPI code
run-name: ${{ github.actor }} is generating openapi code

on:
pull_request:
paths:
- 'typespec/**'
push:
paths:
- 'typespec/**'

jobs:
Typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: npm
cache-dependency-path: 'typespec/package-lock.json'

- name: Install and configure Poetry
uses: snok/install-poetry@v1

- name: Configure Poetry to use .venv
run: |
cd agents-api
poetry config virtualenvs.in-project true

- name: Cache Poetry virtualenv
uses: actions/cache@v4
with:
path: agents-api/.venv
key: ${{ runner.os }}-agents-api-poetry-${{ hashFiles('agents-api/poetry.lock') }}
restore-keys: |
${{ runner.os }}-agents-api-poetry-

- name: Install dependencies
run: |
cd agents-api
poetry install

- name: Generate openapi code
run: |
bash scripts/generate_openapi_code.sh

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

0 comments on commit 4f50d9e

Please sign in to comment.