diff --git a/.github/workflows/docs-generate.yml b/.github/workflows/docs-generate.yml new file mode 100644 index 00000000..65c3b082 --- /dev/null +++ b/.github/workflows/docs-generate.yml @@ -0,0 +1,53 @@ +name: Generate Python Docs on SDK Update + +on: + push: + branches: + - main + paths: + - 'hatchet_sdk/clients/rest/**' + +jobs: + trigger: + runs-on: ubuntu-latest + permissions: write-all + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Checkout Go Repo + uses: actions/checkout@v4 + with: + token: ${{ secrets.TOKEN }} + repository: hatchet-dev/hatchet + path: ./hatchet + + - name: Generate Docs + run: | + pip install pydoc-markdown + pydoc-markdown -p hatchet_sdk/clients/rest --render-toc > docs.md + + # Copy all contexts of docs.md to hatchet/frontend/docs/gen/python + mkdir -p ./hatchet/frontend/docs/gen/python + cp docs.md ./hatchet/frontend/docs/gen/python + + - name: Commit and Push changes to Hatchet Repo + run: | + cd hatchet + git remote -v + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b feat/actions/generate-python-docs + git add . + git commit -m "feat: generate Python Docs" + git push origin feat/actions/generate-python-docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Pull Request + run: | + cd hatchet + gh pr create -R hatchet-dev/hatchet -B main -H feat/actions/generate-python-docs --title 'Generate Python Docs' --body 'This PR generates Python Docs for updated openapi spec.' + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} \ No newline at end of file diff --git a/.github/workflows/sdk-generate.yml b/.github/workflows/sdk-generate.yml new file mode 100644 index 00000000..0e6f39ac --- /dev/null +++ b/.github/workflows/sdk-generate.yml @@ -0,0 +1,49 @@ +name: Generate SDK Client and Make PR + +on: + repository_dispatch: + types: [generate-sdk] + +jobs: + trigger: + runs-on: ubuntu-latest + permissions: write-all + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + token: ${{ secrets.TOKEN }} + - name: 'Checkout hatchet submodule' + uses: actions/checkout@v4 + with: + token: ${{ secrets.TOKEN }} + repository: hatchet-dev/hatchet + path: ./hatchet + - name: Generate Python SDK Client + run: | + # Run generation script + pip install poetry + pip install pre-commit + python3 -m venv /home/runner/.cache/pypoetry/virtualenvs/hatchet-sdk-6GHYpsTj-py3.10 + source /home/runner/.cache/pypoetry/virtualenvs/hatchet-sdk-6GHYpsTj-py3.10/bin/activate + pip install grpcio grpcio-tools + deactivate + bash generate.sh + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b feat/actions/generate-python-sdk-client + git add . + git commit -m "feat: generate Python SDK client" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: feat/actions/generate-python-sdk-client + + - name: create pull request + run: gh pr create -B main -H feat/actions/generate-python-sdk-client --title 'Generate Python SDK client' --body 'This PR generates a Python SDK client for updated openapi spec.' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file